]> source.dussan.org Git - jgit.git/commitdiff
DefaultNoteMerger: Open UnionInputStream in try-with-resource 30/118730/1
authorDavid Pursehouse <david.pursehouse@gmail.com>
Tue, 6 Mar 2018 00:47:11 +0000 (09:47 +0900)
committerDavid Pursehouse <david.pursehouse@gmail.com>
Tue, 6 Mar 2018 00:47:11 +0000 (09:47 +0900)
Change-Id: I035aa89cdbf235992f41e752f49d735be4e5df0a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
org.eclipse.jgit/src/org/eclipse/jgit/notes/DefaultNoteMerger.java

index 87bd4b55b1ee3c29289b29ad91b77eccf5e022a1..54a2d8996a0087ce2a28f211b91f6ba117c253b6 100644 (file)
@@ -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();
                }
        }
 }