From ae1a53a148527db8371679b805765cb76bbe6304 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Tue, 6 Mar 2018 16:52:28 +0900 Subject: [PATCH] EditListTest: Open InputStream in try-with-resource Change-Id: Ib5b86e332ec674dec5460a9629d94d9f94c31c24 Signed-off-by: David Pursehouse --- .../tst/org/eclipse/jgit/patch/EditListTest.java | 13 +++++-------- 1 file 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 61bd8cf9c..6027aff71 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 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(); } } }