summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.3.1/modules
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2008-08-14 11:16:02 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2008-08-14 11:16:02 +0000
commita4191dc7aebdf3e31427569155a79002bf9ca672 (patch)
tree73a8a5efa77f1ac8b9bdb0688801357a7ff1a64d /branches/sca-java-1.3.1/modules
parentb6351266dc09d1eddc88a7d506d610a227d48b9b (diff)
TUSCANY-2535 Take account of spaces that may occur in composite/contribution path names
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@685853 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.3.1/modules')
-rw-r--r--branches/sca-java-1.3.1/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java22
1 files changed, 19 insertions, 3 deletions
diff --git a/branches/sca-java-1.3.1/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java b/branches/sca-java-1.3.1/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
index 5d20d4e893..2d4b728d01 100644
--- a/branches/sca-java-1.3.1/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
+++ b/branches/sca-java-1.3.1/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
@@ -27,6 +27,7 @@ import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.net.URLClassLoader;
+import java.net.URLConnection;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
@@ -454,6 +455,18 @@ public class NodeImpl implements SCANode2, SCAClient {
monitor = monitorFactory.createMonitor();
}
+ /**
+ * Escape the space in URL string
+ * @param uri
+ * @return
+ */
+ private static URI createURI(String uri) {
+ if (uri.indexOf(' ') != -1) {
+ uri = uri.replace(" ", "%20");
+ }
+ return URI.create(uri);
+ }
+
private void configureNode(ConfiguredNodeImplementation configuration) throws Exception {
// Find if any contribution JARs already available locally on the classpath
@@ -463,7 +476,7 @@ public class NodeImpl implements SCANode2, SCAClient {
ContributionService contributionService = runtime.getContributionService();
List<Contribution> contributions = new ArrayList<Contribution>();
for (Contribution contribution : configuration.getContributions()) {
- URI uri = URI.create(contribution.getLocation());
+ URI uri = createURI(contribution.getLocation());
if (uri.getScheme() == null) {
uri = new File(contribution.getLocation()).toURI();
}
@@ -503,13 +516,16 @@ public class NodeImpl implements SCANode2, SCAClient {
// Load the specified composite
StAXArtifactProcessor<Composite> compositeProcessor = artifactProcessors.getProcessor(Composite.class);
if (configuration.getComposite().getName() == null) {
- URI uri = URI.create(configuration.getComposite().getURI());
+ URI uri = createURI(configuration.getComposite().getURI());
if (uri.getScheme() == null) {
uri = new File(configuration.getComposite().getURI()).toURI();
}
URL compositeURL = uri.toURL();
logger.log(Level.INFO, "Loading composite: " + compositeURL);
- InputStream is = compositeURL.openStream();
+ URLConnection connection = compositeURL.openConnection();
+ connection.setDefaultUseCaches(false);
+ connection.setUseCaches(false);
+ InputStream is = connection.getInputStream();
XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
composite = compositeProcessor.read(reader);
} else {