pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1797941 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
Date Wed, 07 Jun 2017 15:26:05 GMT
Author: tilman
Date: Wed Jun  7 15:26:05 2017
New Revision: 1797941

URL: http://svn.apache.org/viewvc?rev=1797941&view=rev
Log:
PDFBOX-2852: use jdk7 syntax

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java?rev=1797941&r1=1797940&r2=1797941&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java Wed Jun  7
15:26:05 2017
@@ -1288,22 +1288,13 @@ public class PDDocument implements Close
      */
     public void saveIncremental(OutputStream output) throws IOException
     {
-        COSWriter writer = null;
-        try
+        if (pdfSource == null)
         {
-            if (pdfSource == null)
-            {
-                throw new IllegalStateException("document was not loaded from a file or a
stream");
-            }
-            writer = new COSWriter(output, pdfSource);
-            writer.write(this, signInterface);
+            throw new IllegalStateException("document was not loaded from a file or a stream");
         }
-        finally
+        try (COSWriter writer = new COSWriter(output, pdfSource))
         {
-            if (writer != null)
-            {
-                writer.close();
-            }
+            writer.write(this, signInterface);
         }
     }
 



Mime
View raw message