From e3f8c0efb82d4a100eae57e9465b701d62b39e15 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Tue, 6 Mar 2018 10:42:36 +0900 Subject: [PATCH] DiffFormatterReflowTest: Open InputStream in try-with-resource Change-Id: Id7f420a2eac57e59fa3feb04236df6f5f8d07f02 Signed-off-by: David Pursehouse --- .../eclipse/jgit/diff/DiffFormatterReflowTest.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffFormatterReflowTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffFormatterReflowTest.java index 31f70cf28..49e5d1b3d 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffFormatterReflowTest.java +++ b/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); - 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(); } } }