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 885c1b5b2..1a158425c 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 void testParse_GitStyleMessage() throws Exception { @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");