pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1567236 - /pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPage.java
Date Tue, 11 Feb 2014 17:49:29 GMT
Author: tilman
Date: Tue Feb 11 17:49:29 2014
New Revision: 1567236

URL: http://svn.apache.org/r1567236
Log:
PDFBOX-1901: fix confusing null check as proposed by Jens Kapitza; removed unneeded null assignments

Modified:
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPage.java

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPage.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPage.java?rev=1567236&r1=1567235&r2=1567236&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPage.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPage.java Tue Feb
11 17:49:29 2014
@@ -254,7 +254,7 @@ public class PDPage implements COSObject
     {
         PDResources retval = getResources();
         PDPageNode parentNode = getParent();
-        if( retval == null && parent != null )
+        if( retval == null && parentNode != null )
         {
             retval = parentNode.findResources();
         }
@@ -454,7 +454,7 @@ public class PDPage implements COSObject
      */
     public PDRectangle getBleedBox()
     {
-        PDRectangle retval = null;
+        PDRectangle retval;
         COSArray array = (COSArray)page.getDictionaryObject( COSName.BLEED_BOX );
         if( array != null )
         {
@@ -493,7 +493,7 @@ public class PDPage implements COSObject
      */
     public PDRectangle getTrimBox()
     {
-        PDRectangle retval = null;
+        PDRectangle retval;
         COSArray array = (COSArray)page.getDictionaryObject( COSName.TRIM_BOX );
         if( array != null )
         {
@@ -532,7 +532,7 @@ public class PDPage implements COSObject
      */
     public PDRectangle getArtBox()
     {
-        PDRectangle retval = null;
+        PDRectangle retval;
         COSArray array = (COSArray)page.getDictionaryObject( COSName.ART_BOX );
         if( array != null )
         {
@@ -751,7 +751,6 @@ public class PDPage implements COSObject
         int heightPx = Math.round(heightPt * scaling);
         //TODO The following reduces accuracy. It should really be a Dimension2D.Float.
         Dimension pageDimension = new Dimension( (int)widthPt, (int)heightPt );
-        BufferedImage retval = null;
         int rotationAngle = findRotation();
         // normalize the rotation angle
         if (rotationAngle < 0)
@@ -763,6 +762,7 @@ public class PDPage implements COSObject
             rotationAngle -= 360;
         }
         // swap width and height
+        BufferedImage retval;
         if (rotationAngle == 90 || rotationAngle == 270)
         {
             retval = new BufferedImage( heightPx, widthPx, imageType );
@@ -839,7 +839,7 @@ public class PDPage implements COSObject
      */
     public List<PDAnnotation> getAnnotations() throws IOException
     {
-        COSArrayList<PDAnnotation> retval = null;
+        COSArrayList<PDAnnotation> retval;
         COSArray annots = (COSArray)page.getDictionaryObject(COSName.ANNOTS);
         if (annots == null)
         {



Mime
View raw message