diff options
author | David Pursehouse <david.pursehouse@sonymobile.com> | 2016-02-12 14:12:25 +0900 |
---|---|---|
committer | David Pursehouse <david.pursehouse@sonymobile.com> | 2016-02-12 14:12:25 +0900 |
commit | 50e21322de4c366da8c7f662b566b9ab1d06a960 (patch) | |
tree | 63998967fc7e38fdab29630ff5855dab862b709e /org.eclipse.jgit.test | |
parent | 35ba741cd4d2371606a20f55e275bcf41c600aea (diff) | |
download | jgit-50e21322de4c366da8c7f662b566b9ab1d06a960.tar.gz jgit-50e21322de4c366da8c7f662b566b9ab1d06a960.zip |
NoteMapTest: Open TreeWalk instances in try-with-resource
Change-Id: I70da0140fe087e7e69c28e9ddd125495d916ec1b
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/notes/NoteMapTest.java | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/notes/NoteMapTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/notes/NoteMapTest.java index 4539a013f3..47b08a7e16 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/notes/NoteMapTest.java +++ b/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 |