diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-07-16 19:28:42 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-07-16 19:28:42 +0000 |
commit | 1e6faea5d81af7847dcdf3bfa274cc294bac8d22 (patch) | |
tree | 56060c066e5054353f9c57248eb96aaab09cfe8d /java/sca/modules/node-launcher-equinox | |
parent | 7eb33fc6b50a9c808d0fc872cb31f42472afb164 (diff) |
Fix the URI conversion
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@794790 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/node-launcher-equinox')
-rw-r--r-- | java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherUtil.java | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherUtil.java b/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherUtil.java index e795723b38..9334125844 100644 --- a/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherUtil.java +++ b/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherUtil.java @@ -90,7 +90,6 @@ final class NodeLauncherUtil { private static final String NODE_IMPLEMENTATION_DAEMON_BOOTSTRAP = "org.apache.tuscany.sca.implementation.node.launcher.NodeImplementationDaemonBootstrap"; - private static final String TUSCANY_HOME = "TUSCANY_HOME"; private static final String TUSCANY_PATH = "TUSCANY_PATH"; @@ -551,11 +550,34 @@ final class NodeLauncherUtil { if (file != null) { return file.toURI(); } else { - try { - return url.toURI(); - } catch (URISyntaxException e) { - throw new IllegalArgumentException(e); - } + return createURI(url.toString()); + } + } + + /** + * Escape the space in URL string + * @param uri + * @return + */ + static URI createURI(String uri) { + if (uri == null) { + return null; + } + if (uri.indexOf('%') != -1) { + // Avoid double-escaping + return URI.create(uri); + } + int index = uri.indexOf(':'); + String scheme = null; + String ssp = uri; + if (index != -1) { + scheme = uri.substring(0, index); + ssp = uri.substring(index + 1); + } + try { + return new URI(scheme, ssp, null); + } catch (URISyntaxException e) { + throw new IllegalArgumentException(e); } } |