summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/modules/node-impl/src/main
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-04-09 06:20:34 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-04-09 06:20:34 +0000
commit8b8b6376e13e53973b50199b6347bbb30882d20a (patch)
tree3c12b182a8e3bfd4138dd290ca81a338dc066f53 /branches/sca-java-1.x/modules/node-impl/src/main
parent3dbcbb77c78c70bb9cb55c0010eb4b472faad695 (diff)
TUSCANY-2862 - Fixing issues when calculating contribution location and provided composite had spaces
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@763523 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/node-impl/src/main')
-rw-r--r--branches/sca-java-1.x/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/branches/sca-java-1.x/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java b/branches/sca-java-1.x/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
index 4a6ac723c2..b0e5352d51 100644
--- a/branches/sca-java-1.x/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
+++ b/branches/sca-java-1.x/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
@@ -25,6 +25,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URI;
+import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLClassLoader;
import java.security.AccessController;
@@ -175,7 +176,9 @@ public class NodeImpl implements SCANode, SCAClient {
logger.log(Level.INFO, "Creating node: " + configurationName);
if (compositeURI != null) {
- URI uri = URI.create(compositeURI);
+ //URI uri = URI.create(compositeURI);
+ URI uri = createURI(compositeURI);
+
if (uri.isAbsolute()) {
throw new IllegalArgumentException("Composite URI must be a resource name: " + compositeURI);
}
@@ -264,10 +267,12 @@ public class NodeImpl implements SCANode, SCAClient {
try {
String url = contributionArtifactURL.toExternalForm();
String protocol = contributionArtifactURL.getProtocol();
+ String escapedContributionArtifactPath = new URI(null, contributionArtifactPath, null).toASCIIString();
+
if ("file".equals(protocol)) {
// directory contribution
- if (url.endsWith(contributionArtifactPath)) {
- final String location = url.substring(0, url.lastIndexOf(contributionArtifactPath));
+ if (url.endsWith(escapedContributionArtifactPath)) {
+ final String location = url.substring(0, url.lastIndexOf(escapedContributionArtifactPath));
// workaround from evil URL/URI form Maven
// contributionURL = FileHelper.toFile(new URL(location)).toURI().toURL();
// Allow privileged access to open URL stream. Add FilePermission to added to
@@ -309,6 +314,8 @@ public class NodeImpl implements SCANode, SCAClient {
}
} catch (MalformedURLException mfe) {
throw new IllegalArgumentException(mfe);
+ } catch (URISyntaxException use) {
+ throw new IllegalArgumentException(use);
}
return contributionURL;
}