listFiles can return null if a different thread removes the dir concurrently (may happen in Solr tests),..

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1598499 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dawid Weiss 2014-05-30 08:53:13 +00:00
parent 19b80d1afe
commit 4dd09dfd07
1 changed files with 10 additions and 8 deletions

View File

@ -120,14 +120,16 @@ public final class TestUtil {
}
private static LinkedHashSet<File> rm(LinkedHashSet<File> unremoved, File... locations) {
for (File location : locations) {
if (location != null && location.exists()) {
if (location.isDirectory()) {
rm(unremoved, location.listFiles());
}
if (!location.delete()) {
unremoved.add(location);
if (locations != null) {
for (File location : locations) {
if (location != null && location.exists()) {
if (location.isDirectory()) {
rm(unremoved, location.listFiles());
}
if (!location.delete()) {
unremoved.add(location);
}
}
}
}