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. 5
      org.eclipse.jgit/src/org/eclipse/jgit/api/BlameCommand.java

5
org.eclipse.jgit/src/org/eclipse/jgit/api/BlameCommand.java

@ -248,11 +248,12 @@ public class BlameCommand extends GitCommand<BlameResult> {
rawText = new RawText(inTree); rawText = new RawText(inTree);
break; break;
case TRUE: case TRUE:
AutoLFInputStream in = new AutoLFInputStream( try (AutoLFInputStream in = new AutoLFInputStream(
new FileInputStream(inTree), true); new FileInputStream(inTree), true)) {
// Canonicalization should lead to same or shorter length // Canonicalization should lead to same or shorter length
// (CRLF to LF), so the file size on disk is an upper size bound // (CRLF to LF), so the file size on disk is an upper size bound
rawText = new RawText(toByteArray(in, (int) inTree.length())); rawText = new RawText(toByteArray(in, (int) inTree.length()));
}
break; break;
default: default:
throw new IllegalArgumentException( throw new IllegalArgumentException(

Loading…
Cancel
Save