aboutsummaryrefslogtreecommitdiffstats
path: root/src/ooxml/testcases/org/apache/poi/openxml4j
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2015-06-24 08:33:06 +0000
committerDominik Stadler <centic@apache.org>2015-06-24 08:33:06 +0000
commit4a8093dc4ff6cd8cfd5e8c8121738128507a683b (patch)
tree93d3334debbd5bcbb85c7cea50ec9e2f208aac82 /src/ooxml/testcases/org/apache/poi/openxml4j
parent27ca5d522afca852abd5507e3f8c430552176071 (diff)
downloadpoi-4a8093dc4ff6cd8cfd5e8c8121738128507a683b.tar.gz
poi-4a8093dc4ff6cd8cfd5e8c8121738128507a683b.zip
show full exception stack-trace if zip-bomb detection test fails
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1687197 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/testcases/org/apache/poi/openxml4j')
-rw-r--r--src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackage.java18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackage.java b/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackage.java
index 01c1b7707d..2383455fce 100644
--- a/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackage.java
+++ b/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackage.java
@@ -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