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();
         }
     }
 


Reply via email to