pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1824163 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDStream.java
Date Tue, 13 Feb 2018 17:27:55 GMT
Author: tilman
Date: Tue Feb 13 17:27:55 2018
New Revision: 1824163

URL: http://svn.apache.org/viewvc?rev=1824163&view=rev
Log:
PDFBOX-4071: use try-with-resources; remove null check because input is never null here

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

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDStream.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDStream.java?rev=1824163&r1=1824162&r2=1824163&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDStream.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDStream.java Tue Feb
13 17:27:55 2018
@@ -124,23 +124,14 @@ public class PDStream implements COSObje
      */
     private PDStream(PDDocument doc, InputStream input, COSBase filters) throws IOException
     {
-        OutputStream output = null;
-        try
+        stream = doc.getDocument().createCOSStream();
+        try (OutputStream output = stream.createOutputStream(filters))
         {
-            stream = doc.getDocument().createCOSStream();
-            output = stream.createOutputStream(filters);
             IOUtils.copy(input, output);
         }
         finally
         {
-            if (output != null)
-            {
-                output.close();
-            }
-            if (input != null)
-            {
-                input.close();
-            }
+            input.close();
         }
     }
 



Mime
View raw message