summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/common-java/src/main/java/org/apache
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-10-14 17:09:50 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-10-14 17:09:50 +0000
commit1d0ca0d129756c9aea37ad5165e19c1ba0a8faf0 (patch)
tree1e50ed81911036f74e7af603e3fca12e62138c42 /java/sca/modules/common-java/src/main/java/org/apache
parentb9c1e93951e71d729ea283e96f39729033465c57 (diff)
Resolve relative path of the contribution locations against the node.xml
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@825196 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/common-java/src/main/java/org/apache')
-rw-r--r--java/sca/modules/common-java/src/main/java/org/apache/tuscany/sca/common/java/io/IOHelper.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/java/sca/modules/common-java/src/main/java/org/apache/tuscany/sca/common/java/io/IOHelper.java b/java/sca/modules/common-java/src/main/java/org/apache/tuscany/sca/common/java/io/IOHelper.java
index f43ff4538b..faa29fa978 100644
--- a/java/sca/modules/common-java/src/main/java/org/apache/tuscany/sca/common/java/io/IOHelper.java
+++ b/java/sca/modules/common-java/src/main/java/org/apache/tuscany/sca/common/java/io/IOHelper.java
@@ -24,6 +24,7 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.JarURLConnection;
+import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
@@ -93,6 +94,21 @@ public class IOHelper {
return createURI(url.toString());
}
+ public static URL normalize(URL url) {
+ // Make sure the trailing / is added to the file directory URL so that
+ // URLClassLoader can load classes from that
+ try {
+ File file = toFile(url);
+ if (file != null) {
+ return file.getAbsoluteFile().toURI().toURL();
+ } else {
+ return toURI(url).toURL();
+ }
+ } catch (MalformedURLException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
/**
* Returns the File object representing the given URL.
*