check null or exists before deleting file

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1593884 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Noble Paul 2014-05-12 03:24:35 +00:00
parent b9e38c0a10
commit 8da5f6301c
1 changed files with 1 additions and 0 deletions

View File

@ -1013,6 +1013,7 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
} }
public static boolean recurseDelete(File f) { public static boolean recurseDelete(File f) {
if(f == null || !f.exists()) return false;
if (f.isDirectory()) { if (f.isDirectory()) {
for (File sub : f.listFiles()) { for (File sub : f.listFiles()) {
if (!recurseDelete(sub)) { if (!recurseDelete(sub)) {