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 a0330c523..2a2e07ddd 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 @@ private RawText getRawText(File inTree) throws IOException, 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(