Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitOnlyTest.java')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitOnlyTest.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitOnlyTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitOnlyTest.java
index 336a335663..5f7434b41f 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitOnlyTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitOnlyTest.java
@@ -1294,10 +1294,12 @@ public class CommitOnlyTest extends RepositoryTestCase {
try {
final Repository repo = git.getRepository();
final ObjectId headId = repo.resolve(Constants.HEAD + "^{commit}");
- final TreeWalk tw = TreeWalk.forPath(repo, path,
- new RevWalk(repo).parseTree(headId));
- return new String(tw.getObjectReader().open(tw.getObjectId(0))
- .getBytes());
+ try (RevWalk rw = new RevWalk(repo)) {
+ final TreeWalk tw = TreeWalk.forPath(repo, path,
+ rw.parseTree(headId));
+ return new String(tw.getObjectReader().open(tw.getObjectId(0))
+ .getBytes());
+ }
} catch (Exception e) {
return "";
}

Back to the top