jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1102601 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/FileDataStore.java
Date Fri, 13 May 2011 08:25:03 GMT
Author: thomasm
Date: Fri May 13 08:25:02 2011
New Revision: 1102601

URL: http://svn.apache.org/viewvc?rev=1102601&view=rev
Log:
JCR-2969 FileDataStore garbage collection can throw a NullPointerException if there is I/O
problem

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/FileDataStore.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/FileDataStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/FileDataStore.java?rev=1102601&r1=1102600&r2=1102601&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/FileDataStore.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/FileDataStore.java
Fri May 13 08:25:02 2011
@@ -324,15 +324,21 @@ public class FileDataStore implements Da
                 }
             }
         } else if (file.isDirectory()) {
-            for (File f: file.listFiles()) {
-                count += deleteOlderRecursive(f, min);
+            File[] list = file.listFiles();
+            if (list != null) {
+                for (File f: list) {
+                    count += deleteOlderRecursive(f, min);
+                }
             }
 
             // JCR-1396: FileDataStore Garbage Collector and empty directories
             // Automatic removal of empty directories (but not the root!)
             synchronized (this) {
-                if (file != directory && file.list().length == 0) {
-                    file.delete();
+                if (file != directory) {
+                    list = file.listFiles();
+                    if (list != null && list.length == 0) {
+                        file.delete();
+                    }
                 }
             }
         }



Mime
View raw message