Skip to content

Apache Lucene open-source search software

Log the file names which could not be deleted

Shalin Shekhar Mangar25736d341b15
diff --git a/src/java/org/apache/solr/handler/SnapPuller.java b/src/java/org/apache/solr/handler/SnapPuller.java
index 162e861842a..605b93f07d1 100644
--- a/src/java/org/apache/solr/handler/SnapPuller.java
+++ b/src/java/org/apache/solr/handler/SnapPuller.java
@@ -587,21 +587,27 @@ public class SnapPuller {
static boolean delTree(File dir) {
if (dir == null || !dir.exists())
return false;
+ boolean isSuccess = true;
File contents[] = dir.listFiles();
if (contents != null) {
for (File file : contents) {
if (file.isDirectory()) {
boolean success = delTree(file);
- if (!success)
- return false;
+ if (!success) {
+ LOG.warn("Unable to delete directory : " + file);
+ isSuccess = false;
+ }
} else {
boolean success = file.delete();
- if (!success)
+ if (!success) {
+ LOG.warn("Unable to delete file : " + file);
+ isSuccess = false;
return false;
+ }
}
}
}
- return dir.delete();
+ return isSuccess && dir.delete();
}
/**
@@ -853,6 +859,7 @@ public class SnapPuller {
//close the file
fileChannel.close();
} catch (Exception e) {/* noop */
+ LOG.error("Error closing the file stream: "+ this.saveAs ,e);
}
try {
post.releaseConnection();