From 6fc873ca14a2a415736a57b239bec0c9ffec2637 Mon Sep 17 00:00:00 2001 From: rfeng Date: Wed, 6 Aug 2008 17:18:40 +0000 Subject: Fix for TUSCANY-2535 git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@683333 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/tuscany/sca/node/impl/NodeImpl.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'java/sca/modules/node2-impl') diff --git a/java/sca/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java b/java/sca/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java index eb39b379b6..76cc89f59e 100644 --- a/java/sca/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java +++ b/java/sca/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java @@ -421,6 +421,18 @@ public class NodeImpl implements SCANode2, SCAClient { MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); 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 { @@ -431,7 +443,7 @@ public class NodeImpl implements SCANode2, SCAClient { ContributionService contributionService = runtime.getContributionService(); List contributions = new ArrayList(); 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(); } @@ -476,7 +488,7 @@ public class NodeImpl implements SCANode2, SCAClient { Contribution contribution; URL compositeURL; - URI uri = URI.create(configuration.getComposite().getURI()); + URI uri = createURI(configuration.getComposite().getURI()); if (uri.getScheme() == null) { // If the composite URI is a relative URI, try to resolve it within the contributions -- cgit v1.2.3