summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@sonymobile.com>2016-02-15 17:19:17 +0900
committerDavid Pursehouse <david.pursehouse@sonymobile.com>2016-02-15 17:19:17 +0900
commitc9e61c7b391d153884e9c8eafe3403fb93bfe8d7 (patch)
tree31246c5e8c6ed23045189f96fed785a6e2c16e2a /org.eclipse.jgit.test
parentfc4ac28aa9749e277ece1f628b64900c10b85d5c (diff)
downloadjgit-c9e61c7b391d153884e9c8eafe3403fb93bfe8d7.tar.gz
jgit-c9e61c7b391d153884e9c8eafe3403fb93bfe8d7.zip
DirCacheBasicTest: Open ObjectInserter.Formatter in try-with-resource
Change-Id: Ie4b3e5ad9616bc56b6d8d2476d1e6c6319c1a0aa Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
Diffstat (limited to 'org.eclipse.jgit.test')
-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();