pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1766078 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationWidget.java
Date Fri, 21 Oct 2016 17:29:47 GMT
Author: tilman
Date: Fri Oct 21 17:29:46 2016
New Revision: 1766078

URL: http://svn.apache.org/viewvc?rev=1766078&view=rev
Log:
PDFBOX-2852: avoid potential ClassCastException,, remove super() call

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationWidget.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationWidget.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationWidget.java?rev=1766078&r1=1766077&r2=1766078&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationWidget.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationWidget.java
Fri Oct 21 17:29:46 2016
@@ -40,7 +40,6 @@ public class PDAnnotationWidget extends
      */
     public PDAnnotationWidget()
     {
-        super();
         getCOSObject().setName(COSName.SUBTYPE, SUB_TYPE);
     }
 
@@ -144,8 +143,12 @@ public class PDAnnotationWidget extends
      */
     public PDAction getAction()
     {
-        COSDictionary action = (COSDictionary) this.getCOSObject().getDictionaryObject(COSName.A);
-        return PDActionFactory.createAction(action);
+        COSBase base = this.getCOSObject().getDictionaryObject(COSName.A);
+        if (base instanceof COSDictionary)
+        {
+            return PDActionFactory.createAction((COSDictionary) base);
+        }
+        return null;
     }
 
     /**
@@ -166,13 +169,12 @@ public class PDAnnotationWidget extends
      */
     public PDAnnotationAdditionalActions getActions()
     {
-        COSDictionary aa = (COSDictionary) this.getCOSObject().getDictionaryObject(COSName.AA);
-        PDAnnotationAdditionalActions retval = null;
-        if (aa != null)
+        COSBase base = this.getCOSObject().getDictionaryObject(COSName.AA);
+        if (base instanceof COSDictionary)
         {
-            retval = new PDAnnotationAdditionalActions(aa);
+            return new PDAnnotationAdditionalActions((COSDictionary) base);
         }
-        return retval;
+        return null;
     }
 
     /**



Mime
View raw message