pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1765850 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationLink.java
Date Thu, 20 Oct 2016 16:50:56 GMT
Author: tilman
Date: Thu Oct 20 16:50:55 2016
New Revision: 1765850

URL: http://svn.apache.org/viewvc?rev=1765850&view=rev
Log:
PDFBOX-3535: avoid ClassCastException, remove super(), set constant

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

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationLink.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationLink.java?rev=1765850&r1=1765849&r2=1765850&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationLink.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationLink.java
Thu Oct 20 16:50:55 2016
@@ -70,7 +70,6 @@ public class PDAnnotationLink extends PD
      */
     public PDAnnotationLink()
     {
-        super();
         getCOSObject().setItem(COSName.SUBTYPE, COSName.getPDFName(SUB_TYPE));
     }
 
@@ -92,8 +91,12 @@ public class PDAnnotationLink extends PD
      */
     public PDAction getAction()
     {
-        COSDictionary action = (COSDictionary) this.getCOSObject().getDictionaryObject(COSName.A);
-        return PDActionFactory.createAction(action);
+        COSBase base = getCOSObject().getDictionaryObject(COSName.A);
+        if (base instanceof COSDictionary)
+        {
+            return PDActionFactory.createAction((COSDictionary) base);
+        }
+        return null;
     }
 
     /**
@@ -195,10 +198,10 @@ public class PDAnnotationLink extends PD
      */
     public PDActionURI getPreviousURI()
     {
-        COSDictionary pa = (COSDictionary) getCOSObject().getDictionaryObject("PA");
-        if (pa != null)
+        COSBase base = getCOSObject().getDictionaryObject("PA");
+        if (base instanceof COSDictionary)
         {
-            return new PDActionURI(pa);
+            return new PDActionURI((COSDictionary) base);
         }
         return null;
     }
@@ -212,7 +215,7 @@ public class PDAnnotationLink extends PD
     {
         COSArray newQuadPoints = new COSArray();
         newQuadPoints.setFloatArray(quadPoints);
-        getCOSObject().setItem("QuadPoints", newQuadPoints);
+        getCOSObject().setItem(COSName.QUADPOINTS, newQuadPoints);
     }
 
     /**
@@ -222,10 +225,10 @@ public class PDAnnotationLink extends PD
      */
     public float[] getQuadPoints()
     {
-        COSArray quadPoints = (COSArray) getCOSObject().getDictionaryObject("QuadPoints");
-        if (quadPoints != null)
+        COSBase base = getCOSObject().getDictionaryObject(COSName.QUADPOINTS);
+        if (base instanceof COSArray)
         {
-            return quadPoints.toFloatArray();
+            return ((COSArray) base).toFloatArray();
         }
         // Should never happen as this is a required item
         return null; 



Mime
View raw message