Browse Source

DirCacheCGitCompatabilityTest: Open TreeWalk in try-with-resource

Change-Id: I81a8bd2aba7eb0a6efaea5d6f7720aa725052157
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
stable-4.2
David Pursehouse 9 years ago
parent
commit
0973c9fc48
  1. 23
      org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java

23
org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java vendored

@ -98,17 +98,18 @@ public class DirCacheCGitCompatabilityTest extends LocalDiskRepositoryTestCase {
assertEquals(ls.size(), dc.getEntryCount());
{
final Iterator<CGitIndexRecord> rItr = ls.values().iterator();
final TreeWalk tw = new TreeWalk(db);
tw.setRecursive(true);
tw.addTree(new DirCacheIterator(dc));
while (rItr.hasNext()) {
final DirCacheIterator dcItr;
assertTrue(tw.next());
dcItr = tw.getTree(0, DirCacheIterator.class);
assertNotNull(dcItr);
assertEqual(rItr.next(), dcItr.getDirCacheEntry());
try (final TreeWalk tw = new TreeWalk(db)) {
tw.setRecursive(true);
tw.addTree(new DirCacheIterator(dc));
while (rItr.hasNext()) {
final DirCacheIterator dcItr;
assertTrue(tw.next());
dcItr = tw.getTree(0, DirCacheIterator.class);
assertNotNull(dcItr);
assertEqual(rItr.next(), dcItr.getDirCacheEntry());
}
}
}
}

Loading…
Cancel
Save