pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1765856 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDFieldFactory.java
Date Thu, 20 Oct 2016 18:10:31 GMT
Author: tilman
Date: Thu Oct 20 18:10:31 2016
New Revision: 1765856

URL: http://svn.apache.org/viewvc?rev=1765856&view=rev
Log:
PDFBOX-2852: avoid potential ClassCastException

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDFieldFactory.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDFieldFactory.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDFieldFactory.java?rev=1765856&r1=1765855&r2=1765856&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDFieldFactory.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDFieldFactory.java
Thu Oct 20 18:10:31 2016
@@ -17,6 +17,7 @@
 
 package org.apache.pdfbox.pdmodel.interactive.form;
 
+import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.cos.COSDictionary;
 import org.apache.pdfbox.cos.COSName;
 
@@ -113,11 +114,10 @@ final class PDFieldFactory
         String retval = dic.getNameAsString(COSName.FT);
         if (retval == null)
         {
-            COSDictionary parent = (COSDictionary) dic.getDictionaryObject(COSName.PARENT,
-                    COSName.P);
-            if (parent != null)
+            COSBase base = dic.getDictionaryObject(COSName.PARENT, COSName.P);
+            if (base instanceof COSDictionary)
             {
-                retval = findFieldType(parent);
+                retval = findFieldType((COSDictionary) base);
             }
         }
         return retval;



Mime
View raw message