Add test-document to verify that bug 51921 is fixed already
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1668482 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7567838f9b
commit
e6d6cbcbd1
@ -18,10 +18,12 @@ package org.apache.poi.stress;
|
|||||||
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
import org.apache.poi.hpbf.HPBFDocument;
|
import org.apache.poi.hpbf.HPBFDocument;
|
||||||
|
import org.apache.poi.hpbf.extractor.PublisherTextExtractor;
|
||||||
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@ -39,11 +41,28 @@ public class HPBFFileHandler extends POIFSFileHandler {
|
|||||||
// a test-case to test this locally without executing the full TestAllFiles
|
// a test-case to test this locally without executing the full TestAllFiles
|
||||||
@Test
|
@Test
|
||||||
public void test() throws Exception {
|
public void test() throws Exception {
|
||||||
InputStream stream = new FileInputStream("test-data/publisher/SampleBrochure.pub");
|
File file = new File("test-data/publisher/SampleBrochure.pub");
|
||||||
|
|
||||||
|
InputStream stream = new FileInputStream(file);
|
||||||
try {
|
try {
|
||||||
handleFile(stream);
|
handleFile(stream);
|
||||||
} finally {
|
} finally {
|
||||||
stream.close();
|
stream.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleExtracting(file);
|
||||||
|
|
||||||
|
stream = new FileInputStream(file);
|
||||||
|
try {
|
||||||
|
PublisherTextExtractor extractor = new PublisherTextExtractor(stream);
|
||||||
|
try {
|
||||||
|
assertNotNull(extractor.getText());
|
||||||
|
} finally {
|
||||||
|
extractor.close();
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
stream.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ public class HWPFFileHandler extends POIFSFileHandler {
|
|||||||
// a test-case to test this locally without executing the full TestAllFiles
|
// a test-case to test this locally without executing the full TestAllFiles
|
||||||
@Test
|
@Test
|
||||||
public void test() throws Exception {
|
public void test() throws Exception {
|
||||||
File file = new File("test-data/document/47304.doc");
|
File file = new File("test-data/document/51921-Word-Crash067.doc");
|
||||||
|
|
||||||
InputStream stream = new FileInputStream(file);
|
InputStream stream = new FileInputStream(file);
|
||||||
try {
|
try {
|
||||||
@ -91,4 +91,4 @@ public class HWPFFileHandler extends POIFSFileHandler {
|
|||||||
stream.close();
|
stream.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,10 @@
|
|||||||
==================================================================== */
|
==================================================================== */
|
||||||
package org.apache.poi.stress;
|
package org.apache.poi.stress;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.PushbackInputStream;
|
||||||
|
|
||||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -36,12 +38,16 @@ public class XWPFFileHandler extends AbstractFileHandler {
|
|||||||
// a test-case to test this locally without executing the full TestAllFiles
|
// a test-case to test this locally without executing the full TestAllFiles
|
||||||
@Test
|
@Test
|
||||||
public void test() throws Exception {
|
public void test() throws Exception {
|
||||||
InputStream stream = new FileInputStream("test-data/document/footnotes.docx");
|
File file = new File("test-data/document/51921-Word-Crash067.docx");
|
||||||
|
|
||||||
|
InputStream stream = new PushbackInputStream(new FileInputStream(file), 100000);
|
||||||
try {
|
try {
|
||||||
handleFile(stream);
|
handleFile(stream);
|
||||||
} finally {
|
} finally {
|
||||||
stream.close();
|
stream.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleExtracting(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
BIN
test-data/document/51921-Word-Crash067.doc
Normal file
BIN
test-data/document/51921-Word-Crash067.doc
Normal file
Binary file not shown.
BIN
test-data/document/51921-Word-Crash067.docx
Normal file
BIN
test-data/document/51921-Word-Crash067.docx
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user