Code clean up
[bgpcep.git] / util / src / test / java / org / opendaylight / protocol / util / ByteArrayTest.java
index 231b5b76077e9ebe3e18e9636ff3b4af88908603..d5652521d8a6bc3403d56953a904741179dfd5b8 100644 (file)
@@ -135,9 +135,8 @@ public class ByteArrayTest {
         final String FILE_TO_TEST = "src/test/resources/PCEStatefulCapabilityTlv1.bin";
 
         final File fileToCompareWith = new File(FILE_TO_TEST);
-        final InputStream bytesIStream = new FileInputStream(fileToCompareWith);
 
-        try {
+        try (InputStream bytesIStream = new FileInputStream(fileToCompareWith)) {
             final byte[] actualBytes = ByteArray.fileToBytes(FILE_TO_TEST);
 
             if (fileToCompareWith.length() > Integer.MAX_VALUE) {
@@ -154,8 +153,6 @@ public class ByteArrayTest {
             }
 
             assertArrayEquals(expectedBytes, actualBytes);
-        } finally {
-            bytesIStream.close();
         }
     }