summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2018-03-06 16:52:28 +0900
committerDavid Pursehouse <david.pursehouse@gmail.com>2018-03-06 16:56:13 +0900
commitae1a53a148527db8371679b805765cb76bbe6304 (patch)
tree7d18b26ba39680de9b16b2aa341441ee161ed9be
parent209bb6ea94e56f4b56abc67d5a50f1734bfd6773 (diff)
downloadjgit-ae1a53a148527db8371679b805765cb76bbe6304.tar.gz
jgit-ae1a53a148527db8371679b805765cb76bbe6304.zip
EditListTest: Open InputStream in try-with-resource
Change-Id: Ib5b86e332ec674dec5460a9629d94d9f94c31c24 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/EditListTest.java13
1 files changed, 5 insertions, 8 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/EditListTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/EditListTest.java
index 61bd8cf9c2..6027aff716 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/EditListTest.java
+++ b/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();
}
}
}