You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2014/05/30 10:54:28 UTC

svn commit: r1598500 - in /lucene/dev/branches/branch_4x: ./ lucene/ lucene/test-framework/ lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java

Author: dweiss
Date: Fri May 30 08:54:28 2014
New Revision: 1598500

URL: http://svn.apache.org/r1598500
Log:
listFiles can return null if a different thread removes the dir concurrently (may happen in Solr tests),..

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/lucene/   (props changed)
    lucene/dev/branches/branch_4x/lucene/test-framework/   (props changed)
    lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java

Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java?rev=1598500&r1=1598499&r2=1598500&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java Fri May 30 08:54:28 2014
@@ -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);
+          }
         }
       }
     }