EditListTest: Open InputStream in try-with-resource

Change-Id: Ib5b86e332ec674dec5460a9629d94d9f94c31c24
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
This commit is contained in:
David Pursehouse 2018-03-06 16:52:28 +09:00
parent 209bb6ea94
commit ae1a53a148
1 changed files with 5 additions and 8 deletions

View File

@ -90,17 +90,14 @@ public void testTypes() throws IOException {
}
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();
}
}
}