commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1775933 - /commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceDataTest.java
Date Fri, 23 Dec 2016 23:32:07 GMT
Author: ggregory
Date: Fri Dec 23 23:32:07 2016
New Revision: 1775933

URL: http://svn.apache.org/viewvc?rev=1775933&view=rev
Log:
Use try with resources.

Modified:
    commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceDataTest.java

Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceDataTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceDataTest.java?rev=1775933&r1=1775932&r2=1775933&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceDataTest.java
(original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceDataTest.java
Fri Dec 23 23:32:07 2016
@@ -107,10 +107,11 @@ public class ByteSourceDataTest extends
 
         // test cache by completely reading InputStream N times.
         for (int j = 0; j < 5; j++) {
-            final InputStream is = byteSource.getInputStream();
-            final byte dst[] = IOUtils.toByteArray(is);
+            try (final InputStream is = byteSource.getInputStream()) {
+                final byte dst[] = IOUtils.toByteArray(is);
 
-            assertArrayEquals(src, dst);
+                assertArrayEquals(src, dst);
+            }
         }
 
         {



Mime
View raw message