Browse Source

EditListTest: Open InputStream in try-with-resource

Change-Id: Ib5b86e332ec674dec5460a9629d94d9f94c31c24
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-4.11
David Pursehouse 7 years ago
parent
commit
ae1a53a148
  1. 13
      org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/EditListTest.java

13
org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/EditListTest.java

@ -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();
}
}
}

Loading…
Cancel
Save