diff options
author | Dominik Stadler <centic@apache.org> | 2015-03-22 21:47:19 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2015-03-22 21:47:19 +0000 |
commit | a4b104d68e4db5856d6da098646760e59de6d8f6 (patch) | |
tree | 623671016c845207bd3bc584caeb68715fa6b0f3 | |
parent | 642ba728728b1936931979a891916c9c534de2f3 (diff) | |
download | poi-a4b104d68e4db5856d6da098646760e59de6d8f6.tar.gz poi-a4b104d68e4db5856d6da098646760e59de6d8f6.zip |
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
-rw-r--r-- | src/integrationtest/org/apache/poi/stress/HPBFFileHandler.java | 21 | ||||
-rw-r--r-- | src/integrationtest/org/apache/poi/stress/HWPFFileHandler.java | 4 | ||||
-rw-r--r-- | src/integrationtest/org/apache/poi/stress/XWPFFileHandler.java | 8 | ||||
-rw-r--r-- | test-data/document/51921-Word-Crash067.doc | bin | 0 -> 56832 bytes | |||
-rw-r--r-- | test-data/document/51921-Word-Crash067.docx | bin | 0 -> 20006 bytes |
5 files changed, 29 insertions, 4 deletions
diff --git a/src/integrationtest/org/apache/poi/stress/HPBFFileHandler.java b/src/integrationtest/org/apache/poi/stress/HPBFFileHandler.java index 31ad8bc123..a41b6ebadf 100644 --- a/src/integrationtest/org/apache/poi/stress/HPBFFileHandler.java +++ b/src/integrationtest/org/apache/poi/stress/HPBFFileHandler.java @@ -18,10 +18,12 @@ package org.apache.poi.stress; 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; @@ -39,11 +41,28 @@ public class HPBFFileHandler extends POIFSFileHandler { // 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(); + } } + } diff --git a/src/integrationtest/org/apache/poi/stress/HWPFFileHandler.java b/src/integrationtest/org/apache/poi/stress/HWPFFileHandler.java index 5f24337fbb..3a223674cd 100644 --- a/src/integrationtest/org/apache/poi/stress/HWPFFileHandler.java +++ b/src/integrationtest/org/apache/poi/stress/HWPFFileHandler.java @@ -68,7 +68,7 @@ public class HWPFFileHandler extends POIFSFileHandler { // 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 { @@ -91,4 +91,4 @@ public class HWPFFileHandler extends POIFSFileHandler { stream.close(); } } -}
\ No newline at end of file +} diff --git a/src/integrationtest/org/apache/poi/stress/XWPFFileHandler.java b/src/integrationtest/org/apache/poi/stress/XWPFFileHandler.java index 47c18d8aa0..c097dc9f71 100644 --- a/src/integrationtest/org/apache/poi/stress/XWPFFileHandler.java +++ b/src/integrationtest/org/apache/poi/stress/XWPFFileHandler.java @@ -16,8 +16,10 @@ ==================================================================== */ 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; @@ -36,12 +38,16 @@ public class XWPFFileHandler extends AbstractFileHandler { // 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 diff --git a/test-data/document/51921-Word-Crash067.doc b/test-data/document/51921-Word-Crash067.doc Binary files differnew file mode 100644 index 0000000000..dc8bfff278 --- /dev/null +++ b/test-data/document/51921-Word-Crash067.doc diff --git a/test-data/document/51921-Word-Crash067.docx b/test-data/document/51921-Word-Crash067.docx Binary files differnew file mode 100644 index 0000000000..12c27c85e4 --- /dev/null +++ b/test-data/document/51921-Word-Crash067.docx |