You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ce...@apache.org on 2015/06/24 10:33:06 UTC

svn commit: r1687197 - /poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackage.java

Author: centic
Date: Wed Jun 24 08:33:06 2015
New Revision: 1687197

URL: http://svn.apache.org/r1687197
Log:
show full exception stack-trace if zip-bomb detection test fails

Modified:
    poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackage.java

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackage.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackage.java?rev=1687197&r1=1687196&r2=1687197&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackage.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackage.java Wed Jun 24 08:33:06 2015
@@ -712,7 +712,7 @@ public final class TestPackage {
             Workbook wb = WorkbookFactory.create(file);
             wb.close();
     
-            // check ratio ouf of bounds
+            // check ratio out of bounds
             ZipSecureFile.setMinInflateRatio(min_ratio+0.002);
             try {
                 wb = WorkbookFactory.create(file);
@@ -721,11 +721,15 @@ public final class TestPackage {
                 // depending if this executed via "ant test" or within eclipse
                 // maybe a difference in JDK ...
             } catch (InvalidFormatException e) {
-                assertEquals("Zip bomb detected! Exiting.", e.getMessage());
+                if(!e.getMessage().equals("Zip bomb detected! Exiting.")) {
+                    throw new IllegalStateException(e);
+                }
             } catch (POIXMLException e) {
                 InvocationTargetException t = (InvocationTargetException)e.getCause();
                 IOException t2 = (IOException)t.getTargetException();
-                assertEquals("Zip bomb detected! Exiting.", t2.getMessage());
+                if(!t2.getMessage().equals("Zip bomb detected! Exiting.")) {
+                    throw new IllegalStateException(e);
+                }
             }
     
             // check max entry size ouf of bounds
@@ -735,11 +739,15 @@ public final class TestPackage {
                 wb = WorkbookFactory.create(file, null, true);
                 wb.close();
             } catch (InvalidFormatException e) {
-                assertEquals("Zip bomb detected! Exiting.", e.getMessage());
+                if(!e.getMessage().equals("Zip bomb detected! Exiting.")) {
+                    throw new IllegalStateException(e);
+                }
             } catch (POIXMLException e) {
                 InvocationTargetException t = (InvocationTargetException)e.getCause();
                 IOException t2 = (IOException)t.getTargetException();
-                assertEquals("Zip bomb detected! Exiting.", t2.getMessage());
+                if(!t2.getMessage().equals("Zip bomb detected! Exiting.")) {
+                    throw new IllegalStateException(e);
+                }
             }
         } finally {
             // reset otherwise a lot of ooxml tests will fail



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org