aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2020-04-27 15:15:11 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2020-04-28 08:48:14 +0200
commitc845db3ec2b73fcb91627a591344174a50d956cb (patch)
treeab8cff65a2d98777bf009ba0bad40138937e3a10
parent7ae35079981dbacecb033fc1980d7d4e16b59fdc (diff)
downloadjgit-c845db3ec2b73fcb91627a591344174a50d956cb.tar.gz
jgit-c845db3ec2b73fcb91627a591344174a50d956cb.zip
RefTreeBatch: fix unclosed resource warning
Change-Id: I7d630d11d3ef2ff2b74ec7a7018760b7b4931ad2 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftree/RefTreeBatch.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftree/RefTreeBatch.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftree/RefTreeBatch.java
index c5560b97bc..b154b95adc 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftree/RefTreeBatch.java
+++ b/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());
} else {
parentCommitId = ObjectId.zeroId();
- parentTreeId = new ObjectInserter.Formatter()
- .idFor(OBJ_TREE, new byte[] {});
+ try (ObjectInserter.Formatter fmt = new ObjectInserter.Formatter()) {
+ parentTreeId = fmt.idFor(OBJ_TREE, new byte[] {});
+ }
tree = RefTree.newEmptyTree();
}
}