pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1765867 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/pattern/PDTilingPattern.java
Date Thu, 20 Oct 2016 19:37:00 GMT
Author: tilman
Date: Thu Oct 20 19:37:00 2016
New Revision: 1765867

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

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/pattern/PDTilingPattern.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/pattern/PDTilingPattern.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/pattern/PDTilingPattern.java?rev=1765867&r1=1765866&r2=1765867&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/pattern/PDTilingPattern.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/pattern/PDTilingPattern.java
Thu Oct 20 19:37:00 2016
@@ -20,6 +20,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import org.apache.pdfbox.contentstream.PDContentStream;
 import org.apache.pdfbox.cos.COSArray;
+import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.cos.COSDictionary;
 import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.cos.COSStream;
@@ -53,7 +54,6 @@ public class PDTilingPattern extends PDA
      */
     public PDTilingPattern()
     {
-        super();
         getCOSObject().setInt(COSName.PATTERN_TYPE, PDAbstractPattern.TYPE_TILING_PATTERN);
     }
 
@@ -174,10 +174,10 @@ public class PDTilingPattern extends PDA
     public PDResources getResources()
     {
         PDResources retval = null;
-        COSDictionary resources = (COSDictionary) getCOSObject().getDictionaryObject(COSName.RESOURCES);
-        if( resources != null )
+        COSBase base = getCOSObject().getDictionaryObject(COSName.RESOURCES);
+        if (base instanceof COSDictionary)
         {
-            retval = new PDResources( resources );
+            retval = new PDResources((COSDictionary) base);
         }
         return retval;
     }
@@ -202,10 +202,10 @@ public class PDTilingPattern extends PDA
     public PDRectangle getBBox()
     {
         PDRectangle retval = null;
-        COSArray array = (COSArray)getCOSObject().getDictionaryObject( COSName.BBOX );
-        if( array != null )
+        COSBase base = getCOSObject().getDictionaryObject(COSName.BBOX);
+        if (base instanceof COSArray)
         {
-            retval = new PDRectangle( array );
+            retval = new PDRectangle((COSArray) base);
         }
         return retval;
     }



Mime
View raw message