Check for symlinks when deleting directories. Allow Database.open()

and close() to throw IOExceptions as well as DatabaseExceptions.
This commit is contained in:
akwizgran
2011-10-03 18:35:18 +01:00
parent 72b594d270
commit 74ca71d9c1
8 changed files with 87 additions and 80 deletions

View File

@@ -75,11 +75,17 @@ public class FileUtils {
}
}
public static void delete(File f) {
if(f.isDirectory()) for(File child : f.listFiles()) delete(child);
public static void delete(File f) throws IOException {
if(f.isDirectory() && !isSymlink(f)) {
for(File child : f.listFiles()) delete(child);
}
f.delete();
}
private static boolean isSymlink(File f) throws IOException {
return org.apache.commons.io.FileUtils.isSymlink(f);
}
public interface Callback {
void processingFile(File f);