From: Javen O'Neal Date: Thu, 22 Sep 2016 09:24:48 +0000 (+0000) Subject: bug 57843: add failing unit test: Word 6.0 (1993) fails with ArrayIndexOutOfBoundsExc... X-Git-Tag: REL_3_16_BETA1~146 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4405fb4ffefe9445958da366c197f0144e495fb8;p=poi.git bug 57843: add failing unit test: Word 6.0 (1993) fails with ArrayIndexOutOfBoundsException git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1761873 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/integrationtest/org/apache/poi/TestAllFiles.java b/src/integrationtest/org/apache/poi/TestAllFiles.java index e364c9f28a..6def523dbf 100644 --- a/src/integrationtest/org/apache/poi/TestAllFiles.java +++ b/src/integrationtest/org/apache/poi/TestAllFiles.java @@ -232,6 +232,7 @@ public class TestAllFiles { EXPECTED_FAILURES.add("spreadsheet/43493.xls"); EXPECTED_FAILURES.add("spreadsheet/46904.xls"); EXPECTED_FAILURES.add("document/Bug50955.doc"); + EXPECTED_FAILURES.add("document/57843.doc"); EXPECTED_FAILURES.add("slideshow/PPT95.ppt"); EXPECTED_FAILURES.add("openxml4j/OPCCompliance_CoreProperties_DCTermsNamespaceLimitedUseFAIL.docx"); EXPECTED_FAILURES.add("openxml4j/OPCCompliance_CoreProperties_DoNotUseCompatibilityMarkupFAIL.docx"); diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java index 6a69aab8a3..b4591ad455 100644 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java @@ -32,11 +32,13 @@ import org.apache.poi.hwpf.model.PlexOfField; import org.apache.poi.hwpf.model.SubdocumentType; import org.apache.poi.hwpf.model.io.HWPFOutputStream; import org.apache.poi.poifs.filesystem.NPOIFSFileSystem; +import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.util.IOUtils; import org.apache.poi.util.POILogFactory; import org.apache.poi.util.POILogger; import java.io.ByteArrayOutputStream; +import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; @@ -901,4 +903,19 @@ public class TestBugs extends TestCase HWPFDocument hwpfDocument2 = HWPFTestDataSamples.writeOutAndReadBack(hwpfDocument); assertNotNull(hwpfDocument2); } + + public void test57843() throws IOException { + try { + File f = POIDataSamples.getDocumentInstance().getFile("57843.doc"); + boolean readOnly = true; + POIFSFileSystem fs = new POIFSFileSystem(f, readOnly); + HWPFOldDocument doc = new HWPFOldDocument(fs); + assertNotNull(doc); + doc.close(); + fs.close(); + fixed("57843"); + } catch (ArrayIndexOutOfBoundsException e) { + // expected until this bug is fixed + } + } } diff --git a/test-data/document/57843.doc b/test-data/document/57843.doc new file mode 100644 index 0000000000..57be6c6ed1 Binary files /dev/null and b/test-data/document/57843.doc differ