summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@sonymobile.com>2016-02-05 17:20:51 +0900
committerDavid Pursehouse <david.pursehouse@sonymobile.com>2016-02-05 17:20:51 +0900
commit5bfdc3341cc0402df8997365899dc06de5bc09a8 (patch)
treed79b8ddad0de8b484d771978b7c48c1202fa88aa
parentf0ef7748b4c4f16fe2a4b945c6076311ec56bddc (diff)
downloadjgit-5bfdc3341cc0402df8997365899dc06de5bc09a8.tar.gz
jgit-5bfdc3341cc0402df8997365899dc06de5bc09a8.zip
RevCommitParseTest: Open ObjectInserter.Formatter in try-with-resource
Change-Id: Iaa87c51bc19b4fa832393c11db20b69865d30d48 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevCommitParseTest.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevCommitParseTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevCommitParseTest.java
index 885c1b5b2d..1a158425c9 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevCommitParseTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevCommitParseTest.java
@@ -452,9 +452,10 @@ public class RevCommitParseTest extends RepositoryTestCase {
@Test
public void testParse_PublicParseMethod()
throws UnsupportedEncodingException {
- ObjectInserter.Formatter fmt = new ObjectInserter.Formatter();
CommitBuilder src = new CommitBuilder();
- src.setTreeId(fmt.idFor(Constants.OBJ_TREE, new byte[] {}));
+ try (ObjectInserter.Formatter fmt = new ObjectInserter.Formatter()) {
+ src.setTreeId(fmt.idFor(Constants.OBJ_TREE, new byte[] {}));
+ }
src.setAuthor(author);
src.setCommitter(committer);
src.setMessage("Test commit\n\nThis is a test.\n");