pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1791985 - /pdfbox/trunk/fontbox/src/test/java/org/apache/fontbox/ttf/BufferedRandomAccessFileTest.java
Date Wed, 19 Apr 2017 21:40:09 GMT
Author: tilman
Date: Wed Apr 19 21:40:08 2017
New Revision: 1791985

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

Modified:
    pdfbox/trunk/fontbox/src/test/java/org/apache/fontbox/ttf/BufferedRandomAccessFileTest.java

Modified: pdfbox/trunk/fontbox/src/test/java/org/apache/fontbox/ttf/BufferedRandomAccessFileTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/test/java/org/apache/fontbox/ttf/BufferedRandomAccessFileTest.java?rev=1791985&r1=1791984&r2=1791985&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/test/java/org/apache/fontbox/ttf/BufferedRandomAccessFileTest.java
(original)
+++ pdfbox/trunk/fontbox/src/test/java/org/apache/fontbox/ttf/BufferedRandomAccessFileTest.java
Wed Apr 19 21:40:08 2017
@@ -40,11 +40,12 @@ public class BufferedRandomAccessFileTes
     {
         final File file = File.createTempFile("apache-pdfbox", ".dat");
 
-        final OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(file));
-        final String content = "1234567890";
-        outputStream.write(content.getBytes("UTF-8"));
-        outputStream.flush();
-        outputStream.close();
+        try (OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(file)))
+        {
+            final String content = "1234567890";
+            outputStream.write(content.getBytes("UTF-8"));
+            outputStream.flush();
+        }
 
         final byte[] readBuffer = new byte[2];
         final BufferedRandomAccessFile buffer = new BufferedRandomAccessFile(file, "r", 4);



Mime
View raw message