EditListTest: Open InputStream in try-with-resource
Change-Id: Ib5b86e332ec674dec5460a9629d94d9f94c31c24 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
This commit is contained in:
parent
209bb6ea94
commit
ae1a53a148
|
@ -90,17 +90,14 @@ public void testTypes() throws IOException {
|
||||||
}
|
}
|
||||||
|
|
||||||
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…
Reference in New Issue