You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by pt...@apache.org on 2014/04/24 21:06:38 UTC
[2/5] git commit: Use decode with the encoding specified.
Use decode with the encoding specified.
Project: http://git-wip-us.apache.org/repos/asf/incubator-storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-storm/commit/0877e153
Tree: http://git-wip-us.apache.org/repos/asf/incubator-storm/tree/0877e153
Diff: http://git-wip-us.apache.org/repos/asf/incubator-storm/diff/0877e153
Branch: refs/heads/master
Commit: 0877e1530eedf4f2cbf03142e32ed773b52ed4bd
Parents: a1871e5
Author: Muneyuki Noguchi <no...@gmail.com>
Authored: Mon Apr 21 08:04:20 2014 +0900
Committer: Muneyuki Noguchi <no...@gmail.com>
Committed: Mon Apr 21 08:06:44 2014 +0900
----------------------------------------------------------------------
.../src/clj/backtype/storm/daemon/supervisor.clj | 2 +-
storm-core/src/clj/backtype/storm/daemon/worker.clj | 2 +-
storm-core/src/clj/backtype/storm/ui/core.clj | 14 +++++++-------
storm-core/src/clj/backtype/storm/util.clj | 3 +++
4 files changed, 12 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/0877e153/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 e2e246f..66e6581 100644
--- a/storm-core/src/clj/backtype/storm/daemon/supervisor.clj
+++ b/storm-core/src/clj/backtype/storm/daemon/supervisor.clj
@@ -69,7 +69,7 @@
(map-val :master-code-dir assignments-snapshot))
(defn- read-downloaded-storm-ids [conf]
- (map #(java.net.URLDecoder/decode %) (read-dir-contents (supervisor-stormdist-root conf)))
+ (map #(url-decode %) (read-dir-contents (supervisor-stormdist-root conf)))
)
(defn read-worker-heartbeat [conf id]
http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/0877e153/storm-core/src/clj/backtype/storm/daemon/worker.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/daemon/worker.clj b/storm-core/src/clj/backtype/storm/daemon/worker.clj
index 3055b66..faff7a0 100644
--- a/storm-core/src/clj/backtype/storm/daemon/worker.clj
+++ b/storm-core/src/clj/backtype/storm/daemon/worker.clj
@@ -451,4 +451,4 @@
(defn -main [storm-id assignment-id port-str worker-id]
(let [conf (read-storm-config)]
(validate-distributed-mode! conf)
- (mk-worker conf nil (java.net.URLDecoder/decode storm-id) assignment-id (Integer/parseInt port-str) worker-id)))
+ (mk-worker conf nil (url-decode storm-id) assignment-id (Integer/parseInt port-str) worker-id)))
http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/0877e153/storm-core/src/clj/backtype/storm/ui/core.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/ui/core.clj b/storm-core/src/clj/backtype/storm/ui/core.clj
index ad4b97f..e108690 100644
--- a/storm-core/src/clj/backtype/storm/ui/core.clj
+++ b/storm-core/src/clj/backtype/storm/ui/core.clj
@@ -1017,7 +1017,7 @@
ui-template))
(GET "/topology/:id" [:as {cookies :cookies} id & m]
(let [include-sys? (get-include-sys? cookies)
- id (java.net.URLDecoder/decode id)]
+ id (url-decode id)]
(try
(-> (topology-page id (:window m) include-sys?)
(concat [(mk-system-toggle-button include-sys?)])
@@ -1025,14 +1025,14 @@
(catch Exception e (resp/redirect "/")))))
(GET "/topology/:id/component/:component" [:as {cookies :cookies} id component & m]
(let [include-sys? (get-include-sys? cookies)
- id (java.net.URLDecoder/decode id)
- component (java.net.URLDecoder/decode component)]
+ id (url-decode id)
+ component (url-decode component)]
(-> (component-page id component (:window m) include-sys?)
(concat [(mk-system-toggle-button include-sys?)])
ui-template)))
(POST "/topology/:id/activate" [id]
(with-nimbus nimbus
- (let [id (java.net.URLDecoder/decode id)
+ (let [id (url-decode id)
tplg (.getTopologyInfo ^Nimbus$Client nimbus id)
name (.get_name tplg)]
(.activate nimbus name)
@@ -1040,7 +1040,7 @@
(resp/redirect (str "/topology/" id)))
(POST "/topology/:id/deactivate" [id]
(with-nimbus nimbus
- (let [id (java.net.URLDecoder/decode id)
+ (let [id (url-decode id)
tplg (.getTopologyInfo ^Nimbus$Client nimbus id)
name (.get_name tplg)]
(.deactivate nimbus name)
@@ -1048,7 +1048,7 @@
(resp/redirect (str "/topology/" id)))
(POST "/topology/:id/rebalance/:wait-time" [id wait-time]
(with-nimbus nimbus
- (let [id (java.net.URLDecoder/decode id)
+ (let [id (url-decode id)
tplg (.getTopologyInfo ^Nimbus$Client nimbus id)
name (.get_name tplg)
options (RebalanceOptions.)]
@@ -1058,7 +1058,7 @@
(resp/redirect (str "/topology/" id)))
(POST "/topology/:id/kill/:wait-time" [id wait-time]
(with-nimbus nimbus
- (let [id (java.net.URLDecoder/decode id)
+ (let [id (url-decode id)
tplg (.getTopologyInfo ^Nimbus$Client nimbus id)
name (.get_name tplg)
options (KillOptions.)]
http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/0877e153/storm-core/src/clj/backtype/storm/util.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/util.clj b/storm-core/src/clj/backtype/storm/util.clj
index dde8b85..fc36b4e 100644
--- a/storm-core/src/clj/backtype/storm/util.clj
+++ b/storm-core/src/clj/backtype/storm/util.clj
@@ -765,6 +765,9 @@
(defn url-encode [s]
(java.net.URLEncoder/encode s "UTF-8"))
+(defn url-decode [s]
+ (java.net.URLDecoder/decode s "UTF-8"))
+
(defn join-maps [& maps]
(let [all-keys (apply set/union (for [m maps] (-> m keys set)))]
(into {}