Browse Source

DefaultNoteMerger: Open UnionInputStream in try-with-resource

Change-Id: I035aa89cdbf235992f41e752f49d735be4e5df0a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-4.11
David Pursehouse 7 years ago
parent
commit
1826341793
  1. 7
      org.eclipse.jgit/src/org/eclipse/jgit/notes/DefaultNoteMerger.java

7
org.eclipse.jgit/src/org/eclipse/jgit/notes/DefaultNoteMerger.java

@ -82,14 +82,11 @@ public class DefaultNoteMerger implements NoteMerger {
ObjectLoader lo = reader.open(ours.getData());
ObjectLoader lt = reader.open(theirs.getData());
UnionInputStream union = new UnionInputStream(lo.openStream(),
lt.openStream());
try {
try (UnionInputStream union = new UnionInputStream(lo.openStream(),
lt.openStream())) {
ObjectId noteData = inserter.insert(Constants.OBJ_BLOB,
lo.getSize() + lt.getSize(), union);
return new Note(ours, noteData);
} finally {
union.close();
}
}
}

Loading…
Cancel
Save