Skip to content

Commit d28d8d5

Browse files
committed
PDFBOX-6025: avoid ClassCastException
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1926693 13f79535-47bb-0310-9956-ffa450edef68
1 parent c1d90d8 commit d28d8d5

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDStructureElementNameTreeNode.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ public PDStructureElementNameTreeNode( COSDictionary dic )
5151
@Override
5252
protected PDStructureElement convertCOSToPD( COSBase base ) throws IOException
5353
{
54+
if (!(base instanceof COSDictionary))
55+
{
56+
throw new IOException("dictionary expected here, but got " + base);
57+
}
5458
return new PDStructureElement((COSDictionary)base);
5559
}
5660

pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/PDIntegerNameTreeNode.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ public PDIntegerNameTreeNode(COSDictionary dic)
5050
@Override
5151
protected COSInteger convertCOSToPD(COSBase base) throws IOException
5252
{
53+
if (!(base instanceof COSInteger))
54+
{
55+
throw new IOException("integer expected here, but got " + base);
56+
}
5357
return (COSInteger)base;
5458
}
5559

0 commit comments

Comments
 (0)