Author: kiwiwings
Date: Wed Mar  9 01:25:02 2016
New Revision: 1734184

URL: http://svn.apache.org/viewvc?rev=1734184&view=rev
Log:
#59058 - OOM when parsing docx after OPCPackage.open with File but not with 
InputStream (TIKA-1866)

Added:
    poi/trunk/test-data/document/bug57031.docx   (with props)
    poi/trunk/test-data/document/bug59058.docx   (with props)
Modified:
    poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/TestXWPFBugs.java

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/TestXWPFBugs.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/TestXWPFBugs.java?rev=1734184&r1=1734183&r2=1734184&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/TestXWPFBugs.java 
(original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/TestXWPFBugs.java Wed Mar 
 9 01:25:02 2016
@@ -21,11 +21,15 @@ import static org.junit.Assert.assertNot
 import static org.junit.Assert.assertTrue;
 
 import java.io.File;
+import java.io.IOException;
 import java.io.InputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
 
 import javax.crypto.Cipher;
 
 import org.apache.poi.POIDataSamples;
+import org.apache.poi.openxml4j.OpenXML4JTestDataSamples;
 import org.apache.poi.openxml4j.opc.OPCPackage;
 import org.apache.poi.poifs.crypt.CipherAlgorithm;
 import org.apache.poi.poifs.crypt.Decryptor;
@@ -34,8 +38,10 @@ import org.apache.poi.poifs.crypt.HashAl
 import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
 import org.apache.poi.xwpf.extractor.XWPFWordExtractor;
 import org.apache.poi.xwpf.usermodel.XWPFDocument;
+import org.apache.xmlbeans.XmlException;
 import org.junit.Assume;
 import org.junit.Test;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.DocumentDocument;
 
 public class TestXWPFBugs {
     /**
@@ -106,4 +112,17 @@ public class TestXWPFBugs {
 
         filesystem.close();
     }
-}
+
+    
+    @Test
+    public void bug59058() throws IOException, XmlException {
+        String files[] = { "bug57031.docx", "bug59058.docx" };
+        for (String f : files) {
+            ZipFile zf = new 
ZipFile(POIDataSamples.getDocumentInstance().getFile(f));
+            ZipEntry entry = zf.getEntry("word/document.xml");
+            DocumentDocument document = 
DocumentDocument.Factory.parse(zf.getInputStream(entry));
+            assertNotNull(document);
+            zf.close();
+        }
+    }
+}
\ No newline at end of file

Added: poi/trunk/test-data/document/bug57031.docx
URL: 
http://svn.apache.org/viewvc/poi/trunk/test-data/document/bug57031.docx?rev=1734184&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/trunk/test-data/document/bug57031.docx
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: poi/trunk/test-data/document/bug59058.docx
URL: 
http://svn.apache.org/viewvc/poi/trunk/test-data/document/bug59058.docx?rev=1734184&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/trunk/test-data/document/bug59058.docx
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to