pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1791988 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java
Date Wed, 19 Apr 2017 21:46:04 GMT
Author: tilman
Date: Wed Apr 19 21:46:04 2017
New Revision: 1791988

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

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java?rev=1791988&r1=1791987&r2=1791988&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java Wed Apr 19
21:46:04 2017
@@ -1538,10 +1538,11 @@ public class COSDictionary extends COSBa
             sb.append("}");
             if (base instanceof COSStream)
             {
-                InputStream stream = ((COSStream) base).createRawInputStream();
-                byte[] b = IOUtils.toByteArray(stream);
-                sb.append("COSStream{").append(Arrays.hashCode(b)).append("}");
-                stream.close();
+                try (InputStream stream = ((COSStream) base).createRawInputStream())
+                {
+                    byte[] b = IOUtils.toByteArray(stream);
+                    sb.append("COSStream{").append(Arrays.hashCode(b)).append("}");
+                }
             }
             return sb.toString();
         }



Mime
View raw message