]> source.dussan.org Git - jgit.git/commitdiff
RevTagParseTest: Open ObjectInserter.Formatter in try-with-resource 72/65972/1
authorDavid Pursehouse <david.pursehouse@sonymobile.com>
Fri, 5 Feb 2016 08:15:19 +0000 (17:15 +0900)
committerDavid Pursehouse <david.pursehouse@sonymobile.com>
Fri, 5 Feb 2016 08:15:19 +0000 (17:15 +0900)
Change-Id: I2341977223be1dc5252492f4775626122f56496b
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevTagParseTest.java

index 82505caf22ff6229bfe2d4eaa3d2558f777aab4c..f97043b7e81b09eede7764586a015b4c2c325a3b 100644 (file)
@@ -463,10 +463,11 @@ public class RevTagParseTest extends RepositoryTestCase {
 
        @Test
        public void testParse_PublicParseMethod() throws CorruptObjectException {
-               ObjectInserter.Formatter fmt = new ObjectInserter.Formatter();
                TagBuilder src = new TagBuilder();
-               src.setObjectId(fmt.idFor(Constants.OBJ_TREE, new byte[] {}),
-                               Constants.OBJ_TREE);
+               try (ObjectInserter.Formatter fmt = new ObjectInserter.Formatter()) {
+                       src.setObjectId(fmt.idFor(Constants.OBJ_TREE, new byte[] {}),
+                                       Constants.OBJ_TREE);
+               }
                src.setTagger(committer);
                src.setTag("a.test");
                src.setMessage("Test tag\n\nThis is a test.\n");