From f0ef7748b4c4f16fe2a4b945c6076311ec56bddc Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Fri, 5 Feb 2016 17:17:12 +0900 Subject: [PATCH] RevObjectTest: Open RevWalk in try-with-resource Change-Id: I19bcbb2f12036c5043436f3d544ccefbb7385b8d Signed-off-by: David Pursehouse --- .../tst/org/eclipse/jgit/revwalk/RevObjectTest.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevObjectTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevObjectTest.java index a768bef19..95e7ca6d5 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevObjectTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevObjectTest.java @@ -73,9 +73,12 @@ public class RevObjectTest extends RevWalkTestCase { assertTrue(a1.equals((Object) a1)); assertFalse(a1.equals("")); - final RevWalk rw2 = new RevWalk(db); - final RevCommit a2 = rw2.parseCommit(a1); - final RevCommit b2 = rw2.parseCommit(b1); + final RevCommit a2; + final RevCommit b2; + try (final RevWalk rw2 = new RevWalk(db)) { + a2 = rw2.parseCommit(a1); + b2 = rw2.parseCommit(b1); + } assertNotSame(a1, a2); assertNotSame(b1, b2);