diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2016-12-18 01:10:25 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2016-12-18 10:38:23 +0100 |
commit | 05e8cdf5634f3c8392235eb34d16df208777311f (patch) | |
tree | 7fb71ecf5b96bf19e6eff4d5d247a783a64c4099 /org.eclipse.jgit | |
parent | 075e55fa285e082a2c99af75008e9419e5cdf6dd (diff) | |
download | jgit-05e8cdf5634f3c8392235eb34d16df208777311f.tar.gz jgit-05e8cdf5634f3c8392235eb34d16df208777311f.zip |
[infer] Fix resource leak in BlameCommand
Bug: 509385
Change-Id: Ic57fd3bf940752229e35102e7761823f7d3d8732
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/BlameCommand.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/BlameCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/BlameCommand.java index a0330c5230..2a2e07ddda 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/BlameCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/BlameCommand.java @@ -248,11 +248,12 @@ public class BlameCommand extends GitCommand<BlameResult> { rawText = new RawText(inTree); break; case TRUE: - AutoLFInputStream in = new AutoLFInputStream( - new FileInputStream(inTree), true); - // Canonicalization should lead to same or shorter length - // (CRLF to LF), so the file size on disk is an upper size bound - rawText = new RawText(toByteArray(in, (int) inTree.length())); + try (AutoLFInputStream in = new AutoLFInputStream( + new FileInputStream(inTree), true)) { + // Canonicalization should lead to same or shorter length + // (CRLF to LF), so the file size on disk is an upper size bound + rawText = new RawText(toByteArray(in, (int) inTree.length())); + } break; default: throw new IllegalArgumentException( |