diff options
author | David Pursehouse <david.pursehouse@gmail.com> | 2018-03-06 10:42:36 +0900 |
---|---|---|
committer | David Pursehouse <david.pursehouse@gmail.com> | 2018-03-06 16:56:12 +0900 |
commit | e3f8c0efb82d4a100eae57e9465b701d62b39e15 (patch) | |
tree | 64c60ae26e4175f0f49a355865d2664c517b810e /org.eclipse.jgit.test/tst/org/eclipse/jgit/diff | |
parent | e6c456eeae1972783974675b3242801f0d8c855c (diff) | |
download | jgit-e3f8c0efb82d4a100eae57e9465b701d62b39e15.tar.gz jgit-e3f8c0efb82d4a100eae57e9465b701d62b39e15.zip |
DiffFormatterReflowTest: Open InputStream in try-with-resource
Change-Id: Id7f420a2eac57e59fa3feb04236df6f5f8d07f02
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/diff')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffFormatterReflowTest.java | 13 |
1 files 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 31f70cf28c..49e5d1b3d4 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(); } } } |