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 { private Patch parseTestPatchFile(final String patchFile) throws IOException {
final InputStream in = getClass().getResourceAsStream(patchFile); try (InputStream in = getClass().getResourceAsStream(patchFile)) {
if (in == null) { if (in == null) {
fail("No " + patchFile + " test vector"); fail("No " + patchFile + " test vector");
return null; // Never happens return null; // Never happens
} }
try {
final Patch p = new Patch(); final Patch p = new Patch();
p.parse(in); p.parse(in);
return p; return p;
} finally {
in.close();
} }
} }
} }

Loading…
Cancel
Save