From 686124bec32fcdee1545e7d9c312dcf0276b44af Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Sat, 11 Apr 2015 00:21:39 +0200 Subject: Replace deprecated release() methods by close() See the discussion [1] in the Gerrit mailing list. [1] https://groups.google.com/forum/#!topic/repo-discuss/RRQT_xCqz4o Change-Id: I2c67384309c5c2e8511a7d0d4e088b4e95f819ff Signed-off-by: Matthias Sohn --- .../tst/org/eclipse/jgit/api/CloneCommandTest.java | 24 ++++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java') diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java index ea07beed70..3b2fa6c37d 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java @@ -414,17 +414,19 @@ public class CloneCommandTest extends RepositoryTestCase { assertEquals(commit, pathStatus.getHeadId()); assertEquals(commit, pathStatus.getIndexId()); - SubmoduleWalk walk = SubmoduleWalk.forIndex(git2.getRepository()); - assertTrue(walk.next()); - Repository clonedSub1 = walk.getRepository(); - addRepoToClose(clonedSub1); - assertNotNull(clonedSub1); - assertEquals( - new File(git2.getRepository().getWorkTree(), walk.getPath()), - clonedSub1.getWorkTree()); - assertEquals(new File(new File(git2.getRepository().getDirectory(), - "modules"), walk.getPath()), clonedSub1.getDirectory()); - walk.release(); + try (SubmoduleWalk walk = SubmoduleWalk + .forIndex(git2.getRepository())) { + assertTrue(walk.next()); + Repository clonedSub1 = walk.getRepository(); + addRepoToClose(clonedSub1); + assertNotNull(clonedSub1); + assertEquals(new File(git2.getRepository().getWorkTree(), + walk.getPath()), clonedSub1.getWorkTree()); + assertEquals( + new File(new File(git2.getRepository().getDirectory(), + "modules"), walk.getPath()), + clonedSub1.getDirectory()); + } } @Test -- cgit v1.2.3