diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java index 1ddac1b57..98c8342de 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java @@ -810,8 +810,9 @@ public class ResolveMerger extends ThreeWayMerger { new MergeFormatter().formatMerge(buf, result, Arrays.asList(commitNames), CHARACTER_ENCODING); buf.close(); - return getObjectInserter().insert(OBJ_BLOB, buf.length(), - buf.openInputStream()); + try (InputStream in = buf.openInputStream()) { + return getObjectInserter().insert(OBJ_BLOB, buf.length(), in); + } } finally { buf.destroy(); }