]> source.dussan.org Git - poi.git/commitdiff
unit test for #52991 (unexpected end of ZLIB input stream)
authorMaxim Valyanskiy <maxcom@apache.org>
Tue, 27 Mar 2012 11:29:39 +0000 (11:29 +0000)
committerMaxim Valyanskiy <maxcom@apache.org>
Tue, 27 Mar 2012 11:29:39 +0000 (11:29 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1305812 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java
test-data/slideshow/badzip.ppt [new file with mode: 0644]

index 56eb0a0d9e597ad4071c2e354645fe707ec68b51..cddacf9fed2286560cb71a04ffa4a387f7ac41f3 100644 (file)
@@ -17,6 +17,7 @@
 
 package org.apache.poi.hslf.extractor;
 
+import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
 import java.util.List;
 
@@ -31,6 +32,7 @@ import org.apache.poi.hwpf.HWPFDocument;
 import org.apache.poi.poifs.filesystem.DirectoryNode;
 import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.util.IOUtils;
 
 /**
  * Tests that the extractor correctly gets the text out of our sample file
@@ -203,7 +205,20 @@ public final class TestExtractor extends TestCase {
          assertEquals("Expected 2 embedded Excel Spreadsheets", 2, num_xls);
          assertEquals("Expected 2 embedded PowerPoint Presentations", 2, num_ppt);
      }
-    
+
+    /**
+     * A powerpoint file with embeded powerpoint files
+     */
+    public void test52991() throws Exception {
+        String path = "badzip.ppt";
+        ppe = new PowerPointExtractor(POIDataSamples.getSlideShowInstance().openResourceAsStream(path));
+        List<OLEShape> shapes = ppe.getOLEShapes();
+        
+        for (OLEShape shape : shapes) {
+            IOUtils.copy(shape.getObjectData().getData(), new ByteArrayOutputStream());
+        }
+    }
+
     /**
      * From bug #45543
      */
diff --git a/test-data/slideshow/badzip.ppt b/test-data/slideshow/badzip.ppt
new file mode 100644 (file)
index 0000000..c8ff00e
Binary files /dev/null and b/test-data/slideshow/badzip.ppt differ