summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@sonymobile.com>2016-02-12 14:02:49 +0900
committerDavid Pursehouse <david.pursehouse@sonymobile.com>2016-02-12 14:02:49 +0900
commitf7a3643fb8c977739af928f2aafc9eeb01a83abc (patch)
treeaa6e2bfa07f664dbcc4d417d3f0b76ed7a7a2843
parenta3923f6b95dcbda701602edd1fa0406dc44d4843 (diff)
downloadjgit-f7a3643fb8c977739af928f2aafc9eeb01a83abc.tar.gz
jgit-f7a3643fb8c977739af928f2aafc9eeb01a83abc.zip
PathSuffixFilterTest: Open TreeWalk in try-with-resource
Change-Id: If0ee71f09a5464e27f0496dac364f8f9bb015eb6 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/PathSuffixFilterTest.java19
1 files changed, 10 insertions, 9 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/PathSuffixFilterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/PathSuffixFilterTest.java
index d871c5ec10..3885c41688 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/PathSuffixFilterTest.java
+++ b/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;
+ }
}
}