am 86da47e8: Fix possible NPE in FileUtils.
* commit '86da47e8d72f275b7f6e111930dfe205cb34423f': Fix possible NPE in FileUtils.main
commit
913173131e
|
@ -25,10 +25,13 @@ import java.io.FilenameFilter;
|
||||||
public class FileUtils {
|
public class FileUtils {
|
||||||
public static boolean deleteRecursively(final File path) {
|
public static boolean deleteRecursively(final File path) {
|
||||||
if (path.isDirectory()) {
|
if (path.isDirectory()) {
|
||||||
for (final File child : path.listFiles()) {
|
final File[] files = path.listFiles();
|
||||||
|
if (files != null) {
|
||||||
|
for (final File child : files) {
|
||||||
deleteRecursively(child);
|
deleteRecursively(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return path.delete();
|
return path.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +40,9 @@ public class FileUtils {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final File[] files = dir.listFiles(fileNameFilter);
|
final File[] files = dir.listFiles(fileNameFilter);
|
||||||
|
if (files == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
boolean hasDeletedAllFiles = true;
|
boolean hasDeletedAllFiles = true;
|
||||||
for (final File file : files) {
|
for (final File file : files) {
|
||||||
if (!deleteRecursively(file)) {
|
if (!deleteRecursively(file)) {
|
||||||
|
|
Loading…
Reference in New Issue