Преглед на файлове

PathSuffixFilterTest: Open TreeWalk in try-with-resource

Change-Id: If0ee71f09a5464e27f0496dac364f8f9bb015eb6
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
tags/v4.3.0.201603230630-rc1
David Pursehouse преди 8 години
родител
ревизия
f7a3643fb8
променени са 1 файла, в които са добавени 10 реда и са изтрити 9 реда
  1. 10
    9
      org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/PathSuffixFilterTest.java

+ 10
- 9
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…
Отказ
Запис