pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1803674 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java
Date Tue, 01 Aug 2017 17:43:53 GMT
Author: tilman
Date: Tue Aug  1 17:43:53 2017
New Revision: 1803674

URL: http://svn.apache.org/viewvc?rev=1803674&view=rev
Log:
PDFBOX-2852: remove unneeded nullcheck; improve javadoc

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java?rev=1803674&r1=1803673&r2=1803674&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java Tue Aug
 1 17:43:53 2017
@@ -378,7 +378,7 @@ public class COSDocument extends COSBase
     /**
      * This will get a list of all available objects.
      *
-     * @return A list of all objects.
+     * @return A list of all objects, never null.
      */
     public List<COSObject> getObjects()
     {
@@ -427,19 +427,15 @@ public class COSDocument extends COSBase
     @Override
     public void close() throws IOException
     {
-        if (!closed) 
+        if (!closed)
         {
             // close all open I/O streams
-            List<COSObject> list = getObjects();
-            if (list != null) 
+            for (COSObject object : getObjects())
             {
-                for (COSObject object : list) 
+                COSBase cosObject = object.getObject();
+                if (cosObject instanceof COSStream)
                 {
-                    COSBase cosObject = object.getObject();
-                    if (cosObject instanceof COSStream)
-                    {
-                        ((COSStream)cosObject).close();
-                    }
+                    ((COSStream) cosObject).close();
                 }
             }
             for (COSStream stream : streams)



Mime
View raw message