Log the file names which could not be deleted

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@736746 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2009-01-22 19:08:47 +00:00
parent fa5b4e8f04
commit 25736d341b
1 changed files with 11 additions and 4 deletions

View File

@ -587,21 +587,27 @@ public class SnapPuller {
static boolean delTree(File dir) { static boolean delTree(File dir) {
if (dir == null || !dir.exists()) if (dir == null || !dir.exists())
return false; return false;
boolean isSuccess = true;
File contents[] = dir.listFiles(); File contents[] = dir.listFiles();
if (contents != null) { if (contents != null) {
for (File file : contents) { for (File file : contents) {
if (file.isDirectory()) { if (file.isDirectory()) {
boolean success = delTree(file); boolean success = delTree(file);
if (!success) if (!success) {
return false; LOG.warn("Unable to delete directory : " + file);
isSuccess = false;
}
} else { } else {
boolean success = file.delete(); boolean success = file.delete();
if (!success) if (!success) {
LOG.warn("Unable to delete file : " + file);
isSuccess = false;
return false; return false;
}
} }
} }
} }
return dir.delete(); return isSuccess && dir.delete();
} }
/** /**
@ -853,6 +859,7 @@ public class SnapPuller {
//close the file //close the file
fileChannel.close(); fileChannel.close();
} catch (Exception e) {/* noop */ } catch (Exception e) {/* noop */
LOG.error("Error closing the file stream: "+ this.saveAs ,e);
} }
try { try {
post.releaseConnection(); post.releaseConnection();