storm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bo...@apache.org
Subject [1/4] git commit: [STORM-239] Allow supervisor to operate in paths with spaces in them
Date Thu, 31 Jul 2014 00:36:51 GMT
Repository: incubator-storm
Updated Branches:
  refs/heads/master c8a6e716a -> b1c5e7eae


[STORM-239] Allow supervisor to operate in paths with spaces in them

Works around a bug in path-escaping for Resources, described here:
http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4466485


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

Branch: refs/heads/master
Commit: dcd4bf7c33c799fca8ea67ba22f1bee7c6b40f4b
Parents: 9e77cd2
Author: Adrian Petrescu <apetresc@gmail.com>
Authored: Fri Jul 11 13:18:30 2014 -0400
Committer: Adrian Petrescu <apetresc@gmail.com>
Committed: Fri Jul 11 17:19:21 2014 -0400

----------------------------------------------------------------------
 storm-core/src/clj/backtype/storm/daemon/supervisor.clj | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/dcd4bf7c/storm-core/src/clj/backtype/storm/daemon/supervisor.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/daemon/supervisor.clj b/storm-core/src/clj/backtype/storm/daemon/supervisor.clj
index 414d894..d9ff3f3 100644
--- a/storm-core/src/clj/backtype/storm/daemon/supervisor.clj
+++ b/storm-core/src/clj/backtype/storm/daemon/supervisor.clj
@@ -15,6 +15,7 @@
 ;; limitations under the License.
 (ns backtype.storm.daemon.supervisor
   (:import [backtype.storm.scheduler ISupervisor])
+  (:import [java.net URI])
   (:use [backtype.storm bootstrap])
   (:use [backtype.storm.daemon common])
   (:require [backtype.storm.daemon [worker :as worker]])
@@ -522,17 +523,19 @@
       (FileUtils/copyDirectory (File. master-code-dir) (File. stormroot))
       (let [classloader (.getContextClassLoader (Thread/currentThread))
             resources-jar (resources-jar)
-            url (.getResource classloader RESOURCES-SUBDIR)
+            ;; Work-around for JDK-4466485
+            uri (if-let [url (.getResource classloader RESOURCES-SUBDIR)]
+                  (URI. (str url)))
             target-dir (str stormroot file-path-separator RESOURCES-SUBDIR)]
             (cond
               resources-jar
               (do
                 (log-message "Extracting resources from jar at " resources-jar " to " target-dir)
                 (extract-dir-from-jar resources-jar RESOURCES-SUBDIR stormroot))
-              url
+              uri
               (do
-                (log-message "Copying resources at " (str url) " to " target-dir)
-                (FileUtils/copyDirectory (File. (.getFile url)) (File. target-dir))
+                (log-message "Copying resources at " (.getPath uri) " to " target-dir)
+                (FileUtils/copyDirectory (File. (.getPath uri)) (File. target-dir))
                 ))
             )))
 


Mime
View raw message