mirror of https://github.com/apache/lucene.git
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:
parent
19b80d1afe
commit
4dd09dfd07
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue