Browse Source

DiffFormatterReflowTest: Open InputStream in try-with-resource

Change-Id: Id7f420a2eac57e59fa3feb04236df6f5f8d07f02
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-4.11
David Pursehouse 7 years ago
parent
commit
e3f8c0efb8
  1. 5
      org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffFormatterReflowTest.java

5
org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffFormatterReflowTest.java

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

Loading…
Cancel
Save