Browse Source

RefTreeBatch: fix unclosed resource warning

Change-Id: I7d630d11d3ef2ff2b74ec7a7018760b7b4931ad2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-5.8
Matthias Sohn 5 years ago
parent
commit
c845db3ec2
  1. 5
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftree/RefTreeBatch.java

5
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftree/RefTreeBatch.java

@ -88,8 +88,9 @@ class RefTreeBatch extends BatchRefUpdate {
tree = RefTree.read(rw.getObjectReader(), c.getTree()); tree = RefTree.read(rw.getObjectReader(), c.getTree());
} else { } else {
parentCommitId = ObjectId.zeroId(); parentCommitId = ObjectId.zeroId();
parentTreeId = new ObjectInserter.Formatter() try (ObjectInserter.Formatter fmt = new ObjectInserter.Formatter()) {
.idFor(OBJ_TREE, new byte[] {}); parentTreeId = fmt.idFor(OBJ_TREE, new byte[] {});
}
tree = RefTree.newEmptyTree(); tree = RefTree.newEmptyTree();
} }
} }

Loading…
Cancel
Save