You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2015/02/16 18:40:57 UTC

svn commit: r1660174 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java

Author: tilman
Date: Mon Feb 16 17:40:56 2015
New Revision: 1660174

URL: http://svn.apache.org/r1660174
Log:
PDFBOX-2576: use interface instead of implementation type; combine if statements; remove unneeded null check

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java?rev=1660174&r1=1660173&r2=1660174&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java Mon Feb 16 17:40:56 2015
@@ -29,6 +29,7 @@ import java.text.DecimalFormat;
 import java.text.NumberFormat;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Deque;
 import java.util.HashSet;
 import java.util.Hashtable;
 import java.util.Iterator;
@@ -185,7 +186,7 @@ public class COSWriter implements ICOSVi
     private final Set<COSBase> objectsToWriteSet = new HashSet<COSBase>();
 
     //A list of objects to write.
-    private final LinkedList<COSBase> objectsToWrite = new LinkedList<COSBase>();
+    private final Deque<COSBase> objectsToWrite = new LinkedList<COSBase>();
 
     //a list of objects already written
     private final Set<COSBase> writtenObjects = new HashSet<COSBase>();
@@ -481,19 +482,16 @@ public class COSWriter implements ICOSVi
                 cosBase = keyObject.get(cosObjectKey);
             }
 
-            if(actual != null && objectKeys.containsKey(actual) &&
-                    cosBase!= null)
+            if (actual != null && objectKeys.containsKey(actual)
+                    && object instanceof COSDictionary
+                    && cosBase instanceof COSDictionary
+                    && !((COSDictionary) object).isNeedToBeUpdated()
+                    && !((COSDictionary) cosBase).isNeedToBeUpdated())
             {
-                if (object instanceof COSDictionary &&
-                        cosBase instanceof COSDictionary &&
-                        !((COSDictionary) object).isNeedToBeUpdated() &&
-                        !((COSDictionary) cosBase).isNeedToBeUpdated()
-                        )
-                {
-                    return;
-                }
+                return;
+
             }
-          
+
             objectsToWrite.add( object );
             objectsToWriteSet.add( object );
             if( actual != null )