Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBasicTest.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBasicTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBasicTest.java
index 0c1baab2b8..014406eb98 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBasicTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBasicTest.java
@@ -255,9 +255,11 @@ public class DirCacheBasicTest extends RepositoryTestCase {
DirCacheBuilder b = dc.builder();
DirCacheEntry e = new DirCacheEntry(path);
e.setFileMode(FileMode.REGULAR_FILE);
- e.setObjectId(new ObjectInserter.Formatter().idFor(
- Constants.OBJ_BLOB,
- Constants.encode(path)));
+ try (ObjectInserter.Formatter formatter = new ObjectInserter.Formatter()) {
+ e.setObjectId(formatter.idFor(
+ Constants.OBJ_BLOB,
+ Constants.encode(path)));
+ }
b.add(e);
b.commit();
db.readDirCache();

Back to the top