brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [2/5] incubator-brooklyn git commit: fix warning when deleting files
Date Mon, 17 Nov 2014 15:23:02 GMT
fix warning when deleting files


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/bf14bb51
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/bf14bb51
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/bf14bb51

Branch: refs/heads/master
Commit: bf14bb51c035765bc1cbd8f2b075780b714a3f7c
Parents: 978d8fd
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Mon Nov 17 11:06:00 2014 +0000
Committer: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Committed: Mon Nov 17 11:07:55 2014 +0000

----------------------------------------------------------------------
 .../rebind/persister/FileBasedStoreObjectAccessor.java   | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/bf14bb51/core/src/main/java/brooklyn/entity/rebind/persister/FileBasedStoreObjectAccessor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/entity/rebind/persister/FileBasedStoreObjectAccessor.java
b/core/src/main/java/brooklyn/entity/rebind/persister/FileBasedStoreObjectAccessor.java
index 9a74cca..acaf660 100644
--- a/core/src/main/java/brooklyn/entity/rebind/persister/FileBasedStoreObjectAccessor.java
+++ b/core/src/main/java/brooklyn/entity/rebind/persister/FileBasedStoreObjectAccessor.java
@@ -97,10 +97,15 @@ public class FileBasedStoreObjectAccessor implements PersistenceObjectStore.Stor
     @Override
     public void delete() {
         if (!file.delete()) {
-            LOG.error("Unable to delete " + file.getAbsolutePath() + ". Probably still locked.");
+            if (!file.exists()) {
+                LOG.debug("Unable to delete " + file.getAbsolutePath() + ". Probably did
not exist.");
+            } else {
+                LOG.warn("Unable to delete " + file.getAbsolutePath() + ". Probably still
locked.");
+            }
         }
-        if (!tmpFile.delete()) {
-            LOG.error("Unable to delete " + tmpFile.getAbsolutePath() + ". Probably still
locked.");
+        if (tmpFile.exists() && !tmpFile.delete()) {
+            // tmpFile is probably already deleted, so don't even log debug if it does not
exist
+            LOG.warn("Unable to delete " + tmpFile.getAbsolutePath() + ". Probably still
locked.");
         }
     }
 


Mime
View raw message