import static org.junit.Assert.assertNotNull;
+import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import org.apache.poi.hpbf.HPBFDocument;
+import org.apache.poi.hpbf.extractor.PublisherTextExtractor;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.junit.Test;
// a test-case to test this locally without executing the full TestAllFiles
@Test
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 {
handleFile(stream);
} finally {
stream.close();
}
+
+ handleExtracting(file);
+
+ stream = new FileInputStream(file);
+ try {
+ PublisherTextExtractor extractor = new PublisherTextExtractor(stream);
+ try {
+ assertNotNull(extractor.getText());
+ } finally {
+ extractor.close();
+ }
+ } finally {
+ stream.close();
+ }
}
+
}
// a test-case to test this locally without executing the full TestAllFiles
@Test
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);
try {
stream.close();
}
}
-}
\ No newline at end of file
+}
==================================================================== */
package org.apache.poi.stress;
+import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
+import java.io.PushbackInputStream;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.junit.Test;
// a test-case to test this locally without executing the full TestAllFiles
@Test
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 {
handleFile(stream);
} finally {
stream.close();
}
+
+ handleExtracting(file);
}
}
\ No newline at end of file