summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x
diff options
context:
space:
mode:
Diffstat (limited to 'branches/sca-java-1.x')
-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;
}