From 25736d341b156c67a2cdabdcc9947102ed2ca1a2 Mon Sep 17 00:00:00 2001 From: Shalin Shekhar Mangar Date: Thu, 22 Jan 2009 19:08:47 +0000 Subject: [PATCH] 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 --- src/java/org/apache/solr/handler/SnapPuller.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) 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();