You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ga...@apache.org on 2015/11/21 03:51:23 UTC

jclouds git commit: don't remove directory if it's a blob

Repository: jclouds
Updated Branches:
  refs/heads/master 2dd231b02 -> ca70d4414


don't remove directory if it's a blob

the filesystem blob store was always removing a/ when a/b was
removed, even if the client explicitly created a/. this patch
fixes that


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

Branch: refs/heads/master
Commit: ca70d441431e9da21d4df9ddb73f5dba0b054f00
Parents: 2dd231b
Author: Ka-Hing Cheung <kh...@hxbc.us>
Authored: Fri Nov 20 17:27:19 2015 -0800
Committer: Ka-Hing Cheung <kh...@hxbc.us>
Committed: Fri Nov 20 17:27:19 2015 -0800

----------------------------------------------------------------------
 .../strategy/internal/FilesystemStorageStrategyImpl.java  | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/ca70d441/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java
----------------------------------------------------------------------
diff --git a/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java b/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java
index bb4e940..b47a642 100644
--- a/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java
+++ b/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java
@@ -794,6 +794,16 @@ public class FilesystemStorageStrategyImpl implements LocalStorageStrategy {
       if (!isNullOrEmpty(parentPath)) {
          // remove parent directory only it's empty
          File directory = new File(buildPathStartingFromBaseDir(container, parentPath));
+         // don't delete directory if it's a directory blob
+         try {
+            UserDefinedFileAttributeView view = getUserDefinedFileAttributeView(directory.toPath());
+            if (!view.list().isEmpty()) {
+               return;
+            }
+         } catch (IOException e) {
+            logger.debug("Could not look for attributes from %s: %s", directory, e);
+         }
+
          String[] children = directory.list();
          if (null == children || children.length == 0) {
             try {