Browse Source

ForPathTest: Open TreeWalk in try-with-resource

Change-Id: Ie4d0eb9c0fe1d8b8f41da161e701137cd7dd178f
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
tags/v4.3.0.201603230630-rc1
David Pursehouse 8 years ago
parent
commit
430b777830
1 changed files with 12 additions and 11 deletions
  1. 12
    11
      org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/ForPathTest.java

+ 12
- 11
org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/ForPathTest.java View File

@@ -84,21 +84,22 @@ public class ForPathTest extends RepositoryTestCase {
ObjectId tree = tree0.writeTree(oi);

// Find the directories that were implicitly created above.
TreeWalk tw = new TreeWalk(or);
tw.addTree(tree);
ObjectId a = null;
ObjectId aSlashC = null;
while (tw.next()) {
if (tw.getPathString().equals("a")) {
a = tw.getObjectId(0);
tw.enterSubtree();
while (tw.next()) {
if (tw.getPathString().equals("a/c")) {
aSlashC = tw.getObjectId(0);
break;
try (TreeWalk tw = new TreeWalk(or)) {
tw.addTree(tree);
while (tw.next()) {
if (tw.getPathString().equals("a")) {
a = tw.getObjectId(0);
tw.enterSubtree();
while (tw.next()) {
if (tw.getPathString().equals("a/c")) {
aSlashC = tw.getObjectId(0);
break;
}
}
break;
}
break;
}
}


Loading…
Cancel
Save