Browse Source

NoteMapTest: Open TreeWalk instances in try-with-resource

Change-Id: I70da0140fe087e7e69c28e9ddd125495d916ec1b
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
stable-4.2
David Pursehouse 9 years ago
parent
commit
50e21322de
  1. 20
      org.eclipse.jgit.test/tst/org/eclipse/jgit/notes/NoteMapTest.java

20
org.eclipse.jgit.test/tst/org/eclipse/jgit/notes/NoteMapTest.java

@ -403,10 +403,12 @@ public class NoteMapTest extends RepositoryTestCase {
}
RevCommit n = commitNoteMap(map);
TreeWalk tw = new TreeWalk(reader);
tw.reset(n.getTree());
while (tw.next())
assertFalse("no fan-out subtree", tw.isSubtree());
try (TreeWalk tw = new TreeWalk(reader)) {
tw.reset(n.getTree());
while (tw.next()) {
assertFalse("no fan-out subtree", tw.isSubtree());
}
}
for (int i = 254; i < 256; i++) {
idBuf.setByte(Constants.OBJECT_ID_LENGTH - 1, i);
@ -418,13 +420,15 @@ public class NoteMapTest extends RepositoryTestCase {
// The 00 bucket is fully split.
String path = fanout(38, idBuf.name());
tw = TreeWalk.forPath(reader, path, n.getTree());
assertNotNull("has " + path, tw);
try (TreeWalk tw = TreeWalk.forPath(reader, path, n.getTree())) {
assertNotNull("has " + path, tw);
}
// The other bucket is not.
path = fanout(2, data1.name());
tw = TreeWalk.forPath(reader, path, n.getTree());
assertNotNull("has " + path, tw);
try (TreeWalk tw = TreeWalk.forPath(reader, path, n.getTree())) {
assertNotNull("has " + path, tw);
}
}
@Test

Loading…
Cancel
Save