pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1832288 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationSquareCircle.java
Date Sat, 26 May 2018 02:15:13 GMT
Author: tilman
Date: Sat May 26 02:15:13 2018
New Revision: 1832288

URL: http://svn.apache.org/viewvc?rev=1832288&view=rev
Log:
PDFBOX-3353: avoid ClassCastException, fix javadoc

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

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationSquareCircle.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationSquareCircle.java?rev=1832288&r1=1832287&r2=1832288&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationSquareCircle.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationSquareCircle.java
Sat May 26 02:15:13 2018
@@ -25,7 +25,8 @@ import org.apache.pdfbox.pdmodel.common.
 import org.apache.pdfbox.pdmodel.graphics.color.PDColor;
 
 /**
- * This is the class that represents a rectangular or elliptical annotation introduced in
PDF 1.3 specification .
+ * This is the class that represents a rectangular or elliptical annotation introduced in
PDF 1.3
+ * specification .
  *
  * @author Paul King
  */
@@ -76,7 +77,8 @@ public abstract class PDAnnotationSquare
     }
 
     /**
-     * This will set the border effect dictionary, specifying effects to be applied when
drawing the line.
+     * This will set the border effect dictionary, specifying effects to be applied when
drawing the
+     * line.
      *
      * @param be The border effect dictionary to set.
      *
@@ -87,26 +89,25 @@ public abstract class PDAnnotationSquare
     }
 
     /**
-     * This will retrieve the border effect dictionary, specifying effects to be applied
used in drawing the line.
+     * This will retrieve the border effect dictionary, specifying effects to be applied
used in
+     * drawing the line.
      *
      * @return The border effect dictionary
      */
     public PDBorderEffectDictionary getBorderEffect()
     {
-        COSDictionary be = (COSDictionary) getCOSObject().getDictionaryObject(COSName.BE);
-        if (be != null)
+        COSBase base = getCOSObject().getDictionaryObject(COSName.BE);
+        if (base instanceof COSDictionary)
         {
-            return new PDBorderEffectDictionary(be);
-        }
-        else
-        {
-            return null;
+            return new PDBorderEffectDictionary((COSDictionary) base);
         }
+        return null;
     }
 
     /**
-     * This will set the rectangle difference rectangle. Giving the difference between the
annotations rectangle and
-     * where the drawing occurs. (To take account of any effects applied through the BE entry
forexample)
+     * This will set the rectangle difference rectangle. Giving the difference between the
+     * annotations rectangle and where the drawing occurs. (To take account of any effects
applied
+     * through the BE entry for example)
      *
      * @param rd the rectangle difference
      *
@@ -117,26 +118,25 @@ public abstract class PDAnnotationSquare
     }
 
     /**
-     * This will get the rectangle difference rectangle. Giving the difference between the
annotations rectangle and
-     * where the drawing occurs. (To take account of any effects applied through the BE entry
forexample)
+     * This will get the rectangle difference rectangle. Giving the difference between the
+     * annotations rectangle and where the drawing occurs. (To take account of any effects
applied
+     * through the BE entry for example)
      *
      * @return the rectangle difference
      */
     public PDRectangle getRectDifference()
     {
-        COSArray rd = (COSArray) getCOSObject().getDictionaryObject(COSName.RD);
-        if (rd != null)
+        COSBase base = getCOSObject().getDictionaryObject(COSName.RD);
+        if (base instanceof COSArray)
         {
-            return new PDRectangle(rd);
-        }
-        else
-        {
-            return null;
+            return new PDRectangle((COSArray) base);
         }
+        return null;
     }
 
     /**
-     * This will set the border style dictionary, specifying the width and dash pattern used
in drawing the line.
+     * This will set the border style dictionary, specifying the width and dash pattern used
in
+     * drawing the line.
      *
      * @param bs the border style dictionary to set. TODO not all annotations may have a
BS entry
      *
@@ -148,7 +148,8 @@ public abstract class PDAnnotationSquare
     }
 
     /**
-     * This will retrieve the border style dictionary, specifying the width and dash pattern
used in drawing the line.
+     * This will retrieve the border style dictionary, specifying the width and dash pattern
used in
+     * drawing the line.
      *
      * @return the border style dictionary. TODO not all annotations may have a BS entry
      */
@@ -162,16 +163,18 @@ public abstract class PDAnnotationSquare
         }
         return null;
     }
-    
+
     /**
-     * This will set the difference between the annotations "outer" rectangle defined by
-     * /Rect and the border.
-     * 
-     * <p>This will set an equal difference for all sides</p>
-     * 
+     * This will set the difference between the annotations "outer" rectangle defined by
/Rect and
+     * the border.
+     *
+     * <p>
+     * This will set an equal difference for all sides</p>
+     *
      * @param difference from the annotations /Rect entry
      */
-    public void setRectDifferences(float difference) {
+    public void setRectDifferences(float difference)
+    {
         setRectDifferences(difference, difference, difference, difference);
     }
     



Mime
View raw message