Author: centic
Date: Mon Aug  7 11:11:08 2023
New Revision: 1911503

URL: http://svn.apache.org/viewvc?rev=1911503&view=rev
Log:
Bug 66425: Avoid a ClassCastException found via oss-fuzz

Add exception details and fix expected exceptions to make tests run again

Modified:
    
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java
    
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hsmf/datatypes/Chunks.java
    poi/trunk/test-data/spreadsheet/stress.xls

Modified: 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java?rev=1911503&r1=1911502&r2=1911503&view=diff
==============================================================================
--- 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java
 (original)
+++ 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java
 Mon Aug  7 11:11:08 2023
@@ -286,7 +286,7 @@ public class XWPFDocument extends POIXML
                         }
                     }
                 } 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();

Modified: 
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hsmf/datatypes/Chunks.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hsmf/datatypes/Chunks.java?rev=1911503&r1=1911502&r2=1911503&view=diff
==============================================================================
--- 
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hsmf/datatypes/Chunks.java
 (original)
+++ 
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hsmf/datatypes/Chunks.java
 Mon Aug  7 11:11:08 2023
@@ -251,7 +251,7 @@ public final class Chunks implements Chu
             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);
         }
     }
 

Modified: poi/trunk/test-data/spreadsheet/stress.xls
URL: 
http://svn.apache.org/viewvc/poi/trunk/test-data/spreadsheet/stress.xls?rev=1911503&r1=1911502&r2=1911503&view=diff
==============================================================================
Binary files - no diff available.



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

Reply via email to