Repository: storm
Updated Branches:
  refs/heads/1.x-branch 885aaec43 -> a1a4df7a1


STORM-1629 Files/move doesn't work properly with non-empty directory in Windows

* Use FileUtils/moveDirectory on Windows
  * It copies whole contents inside directory, and delete directory
* Keep using Files/move on non-Windows
  * it's still better option since doesn't require copying contents inside 
directory


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

Branch: refs/heads/1.x-branch
Commit: 7b559ef3d8e02047a15860d261bc0a40d08834e0
Parents: 80213ba
Author: Jungtaek Lim <[email protected]>
Authored: Wed Mar 16 00:37:28 2016 +0900
Committer: Jungtaek Lim <[email protected]>
Committed: Wed Mar 16 00:37:28 2016 +0900

----------------------------------------------------------------------
 storm-core/src/clj/org/apache/storm/daemon/supervisor.clj | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/7b559ef3/storm-core/src/clj/org/apache/storm/daemon/supervisor.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/org/apache/storm/daemon/supervisor.clj 
b/storm-core/src/clj/org/apache/storm/daemon/supervisor.clj
index 1287d77..b37b9da 100644
--- a/storm-core/src/clj/org/apache/storm/daemon/supervisor.clj
+++ b/storm-core/src/clj/org/apache/storm/daemon/supervisor.clj
@@ -959,9 +959,13 @@
     (if (download-blobs-for-topology-succeed? (supervisor-stormconf-path 
tmproot) tmproot)
       (do
         (log-message "Successfully downloaded blob resources for storm-id " 
storm-id)
-        (FileUtils/forceMkdir (File. stormroot))
-        (Files/move (.toPath (File. tmproot)) (.toPath (File. stormroot))
-          (doto (make-array StandardCopyOption 1) (aset 0 
StandardCopyOption/ATOMIC_MOVE)))
+        (if on-windows?
+          ; Files/move with non-empty directory doesn't work well on Windows
+          (FileUtils/moveDirectory (File. tmproot) (File. stormroot))
+          (do
+            (FileUtils/forceMkdir (File. stormroot))
+            (Files/move (.toPath (File. tmproot)) (.toPath (File. stormroot))
+                        (doto (make-array StandardCopyOption 1) (aset 0 
StandardCopyOption/ATOMIC_MOVE)))))
         (setup-storm-code-dir conf (read-supervisor-storm-conf conf storm-id) 
stormroot))
       (do
         (log-message "Failed to download blob resources for storm-id " 
storm-id)

Reply via email to