Browse Source

[infer] Fix resource leak in BlameCommand

Bug: 509385
Change-Id: Ic57fd3bf940752229e35102e7761823f7d3d8732
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-4.6
Matthias Sohn 8 years ago
parent
commit
05e8cdf563
  1. 11
      org.eclipse.jgit/src/org/eclipse/jgit/api/BlameCommand.java

11
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(

Loading…
Cancel
Save