]> source.dussan.org Git - jgit.git/commitdiff
EditListTest: Open InputStream in try-with-resource 49/118749/2
authorDavid Pursehouse <david.pursehouse@gmail.com>
Tue, 6 Mar 2018 07:52:28 +0000 (16:52 +0900)
committerDavid Pursehouse <david.pursehouse@gmail.com>
Tue, 6 Mar 2018 07:56:13 +0000 (16:56 +0900)
Change-Id: Ib5b86e332ec674dec5460a9629d94d9f94c31c24
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/EditListTest.java

index 61bd8cf9c2df58f4fa6bdef6b8a4192ae71ead2a..6027aff716bb191517f14811ecb0e9f6ecbfec6e 100644 (file)
@@ -90,17 +90,14 @@ public class EditListTest {
        }
 
        private Patch parseTestPatchFile(final String patchFile) throws IOException {
-               final InputStream in = getClass().getResourceAsStream(patchFile);
-               if (in == null) {
-                       fail("No " + patchFile + " test vector");
-                       return null; // Never happens
-               }
-               try {
+               try (InputStream in = getClass().getResourceAsStream(patchFile)) {
+                       if (in == null) {
+                               fail("No " + patchFile + " test vector");
+                               return null; // Never happens
+                       }
                        final Patch p = new Patch();
                        p.parse(in);
                        return p;
-               } finally {
-                       in.close();
                }
        }
 }