aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2023-08-07 11:11:08 +0000
committerDominik Stadler <centic@apache.org>2023-08-07 11:11:08 +0000
commita8b31c37a6728063f9e5df620c6f885990de0e93 (patch)
tree3369fd8121d26bf615524279345e261a4b865664
parent31fd087a4895239e01d09ee68389b2a5e78c3d47 (diff)
downloadpoi-a8b31c37a6728063f9e5df620c6f885990de0e93.tar.gz
poi-a8b31c37a6728063f9e5df620c6f885990de0e93.zip
Bug 66425: Avoid a ClassCastException found via oss-fuzz
Add exception details and fix expected exceptions to make tests run again git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1911503 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java2
-rw-r--r--poi-scratchpad/src/main/java/org/apache/poi/hsmf/datatypes/Chunks.java2
-rw-r--r--test-data/spreadsheet/stress.xlsbin58880 -> 59392 bytes
3 files changed, 2 insertions, 2 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java
index 1ddc55d98a..b5c926967e 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java
@@ -286,7 +286,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
}
}
} catch (ClassCastException e) {
- throw new IllegalArgumentException("Relation and type of document-part did not match, had relation " + relation + " and type of document-part: " + p.getClass());
+ throw new IllegalArgumentException("Relation and type of document-part did not match, had relation " + relation + " and type of document-part: " + p.getClass(), e);
}
}
initHyperlinks();
diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hsmf/datatypes/Chunks.java b/poi-scratchpad/src/main/java/org/apache/poi/hsmf/datatypes/Chunks.java
index 2ffcb3f3b2..37105fc8d0 100644
--- a/poi-scratchpad/src/main/java/org/apache/poi/hsmf/datatypes/Chunks.java
+++ b/poi-scratchpad/src/main/java/org/apache/poi/hsmf/datatypes/Chunks.java
@@ -251,7 +251,7 @@ public final class Chunks implements ChunkGroupWithProperties {
allChunks.computeIfAbsent(prop, k -> new ArrayList<>());
allChunks.get(prop).add(chunk);
} catch (ClassCastException e) {
- throw new IllegalArgumentException("Property and type of chunk did not match, had property " + prop + " and type of chunk: " + chunk.getClass());
+ throw new IllegalArgumentException("Property and type of chunk did not match, had property " + prop + " and type of chunk: " + chunk.getClass(), e);
}
}
diff --git a/test-data/spreadsheet/stress.xls b/test-data/spreadsheet/stress.xls
index 74b0f1b5da..bfa0cd3f93 100644
--- a/test-data/spreadsheet/stress.xls
+++ b/test-data/spreadsheet/stress.xls
Binary files differ