Avoid NPE if deleteDirectory fails to list files to clean up
This commit is contained in:
parent
7a5d1434fb
commit
f981dbd7cf
|
@ -63,10 +63,15 @@ public class FileUtil {
|
|||
attempts++;
|
||||
}
|
||||
|
||||
for (String file : files) {
|
||||
File f = new File(directory, file);
|
||||
if (!deleteDirectory(f)) {
|
||||
logger.warn("Failed to clean up file: " + f.getAbsolutePath());
|
||||
if (files == null) {
|
||||
logger.warn("Could not list files to clean up in: " + directory.getAbsolutePath());
|
||||
}
|
||||
else {
|
||||
for (String file : files) {
|
||||
File f = new File(directory, file);
|
||||
if (!deleteDirectory(f)) {
|
||||
logger.warn("Failed to clean up file: " + f.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue