You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by al...@apache.org on 2014/11/03 16:52:12 UTC

[28/29] git commit: decode the URL as per @neykov's comment

decode the URL as per @neykov's comment

(i think in case it is of the form my%20file.txt )


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

Branch: refs/heads/master
Commit: 1bb15610cb5dd3419c8cdb8395d6dda0238adcab
Parents: 0323f48
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Sat Nov 1 11:26:22 2014 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Sat Nov 1 11:26:52 2014 +0000

----------------------------------------------------------------------
 .../entity/brooklynnode/BrooklynNodeSshDriver.java      | 12 +++++-------
 utils/common/src/main/java/brooklyn/util/net/Urls.java  |  6 ++++++
 2 files changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/1bb15610/software/base/src/main/java/brooklyn/entity/brooklynnode/BrooklynNodeSshDriver.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/brooklyn/entity/brooklynnode/BrooklynNodeSshDriver.java b/software/base/src/main/java/brooklyn/entity/brooklynnode/BrooklynNodeSshDriver.java
index add3f8f..efc9546 100644
--- a/software/base/src/main/java/brooklyn/entity/brooklynnode/BrooklynNodeSshDriver.java
+++ b/software/base/src/main/java/brooklyn/entity/brooklynnode/BrooklynNodeSshDriver.java
@@ -95,14 +95,12 @@ public class BrooklynNodeSshDriver extends JavaSoftwareProcessSshDriver implemen
             // assume the dir name is `basename-VERSION` where download link is `basename-VERSION-dist.tar.gz`
             String uploadUrl = entity.getConfig(BrooklynNode.DISTRO_UPLOAD_URL);
             String origDownloadName = uploadUrl;
-            if (origDownloadName==null) { 
-                String downloadUrlTemplate = entity.getAttribute(BrooklynNode.DOWNLOAD_URL);
-                if (downloadUrlTemplate!=null) {
-                    // BasicDownloadResolver makes it crazy hard to get the template-evaluated value of DOWNLOAD_URL
-                    origDownloadName = DownloadSubstituters.substitute(downloadUrlTemplate, DownloadSubstituters.getBasicEntitySubstitutions(this));
-                }
-            }
+            if (origDownloadName==null) 
+                origDownloadName = entity.getAttribute(BrooklynNode.DOWNLOAD_URL);
             if (origDownloadName!=null) {
+                // BasicDownloadResolver makes it crazy hard to get the template-evaluated value of DOWNLOAD_URL
+                origDownloadName = DownloadSubstituters.substitute(origDownloadName, DownloadSubstituters.getBasicEntitySubstitutions(this));
+                origDownloadName = Urls.decode(origDownloadName);
                 origDownloadName = Urls.getBasename(origDownloadName);
                 String downloadName = origDownloadName;
                 downloadName = Strings.removeFromEnd(downloadName, ".tar.gz");

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/1bb15610/utils/common/src/main/java/brooklyn/util/net/Urls.java
----------------------------------------------------------------------
diff --git a/utils/common/src/main/java/brooklyn/util/net/Urls.java b/utils/common/src/main/java/brooklyn/util/net/Urls.java
index ea11095..927051a 100644
--- a/utils/common/src/main/java/brooklyn/util/net/Urls.java
+++ b/utils/common/src/main/java/brooklyn/util/net/Urls.java
@@ -23,6 +23,7 @@ import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
+import java.net.URLDecoder;
 import java.net.URLEncoder;
 
 import javax.annotation.Nullable;
@@ -142,6 +143,11 @@ public class Urls {
     public static String encode(String text) {
         return URLEncoder.encode(text);
     }
+    /** As {@link #encode(String)} */
+    @SuppressWarnings("deprecation")
+    public static String decode(String text) {
+        return URLDecoder.decode(text);
+    }
 
     /** returns the protocol (e.g. http) if one appears to be specified, or else null;
      * 'protocol' here should consist of 2 or more _letters_ only followed by a colon