Browse Source

PathSuffixFilterTest: Open TreeWalk in try-with-resource

Change-Id: If0ee71f09a5464e27f0496dac364f8f9bb015eb6
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
stable-4.2
David Pursehouse 9 years ago
parent
commit
f7a3643fb8
  1. 19
      org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/PathSuffixFilterTest.java

19
org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/PathSuffixFilterTest.java

@ -113,15 +113,16 @@ public class PathSuffixFilterTest extends RepositoryTestCase {
private List<String> getMatchingPaths(String suffixFilter,
final ObjectId treeId, boolean recursiveWalk) throws IOException {
final TreeWalk tw = new TreeWalk(db);
tw.setFilter(PathSuffixFilter.create(suffixFilter));
tw.setRecursive(recursiveWalk);
tw.addTree(treeId);
List<String> paths = new ArrayList<String>();
while (tw.next())
paths.add(tw.getPathString());
return paths;
try (final TreeWalk tw = new TreeWalk(db)) {
tw.setFilter(PathSuffixFilter.create(suffixFilter));
tw.setRecursive(recursiveWalk);
tw.addTree(treeId);
List<String> paths = new ArrayList<String>();
while (tw.next())
paths.add(tw.getPathString());
return paths;
}
}
}

Loading…
Cancel
Save