You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by lr...@apache.org on 2009/04/09 08:20:35 UTC
svn commit: r763523 -
/tuscany/branches/sca-java-1.x/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
Author: lresende
Date: Thu Apr 9 06:20:34 2009
New Revision: 763523
URL: http://svn.apache.org/viewvc?rev=763523&view=rev
Log:
TUSCANY-2862 - Fixing issues when calculating contribution location and provided composite had spaces
Modified:
tuscany/branches/sca-java-1.x/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
Modified: tuscany/branches/sca-java-1.x/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java?rev=763523&r1=763522&r2=763523&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java (original)
+++ tuscany/branches/sca-java-1.x/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java Thu Apr 9 06:20:34 2009
@@ -25,6 +25,7 @@
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 @@
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 @@
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 @@
}
} catch (MalformedURLException mfe) {
throw new IllegalArgumentException(mfe);
+ } catch (URISyntaxException use) {
+ throw new IllegalArgumentException(use);
}
return contributionURL;
}