DefaultNoteMerger: Open UnionInputStream in try-with-resource

Change-Id: I035aa89cdbf235992f41e752f49d735be4e5df0a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
This commit is contained in:
David Pursehouse 2018-03-06 09:47:11 +09:00
parent 06fbd7c5fa
commit 1826341793
1 changed files with 2 additions and 5 deletions

View File

@ -82,14 +82,11 @@ public Note merge(Note base, Note ours, Note theirs, ObjectReader reader,
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();
}
}
}