diff options
Diffstat (limited to 'sca-java-2.x/trunk/modules/common-java/src/main')
-rw-r--r-- | sca-java-2.x/trunk/modules/common-java/src/main/java/org/apache/tuscany/sca/common/java/io/IOHelper.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/modules/common-java/src/main/java/org/apache/tuscany/sca/common/java/io/IOHelper.java b/sca-java-2.x/trunk/modules/common-java/src/main/java/org/apache/tuscany/sca/common/java/io/IOHelper.java index 7e8c6b108e..91aef7a65f 100644 --- a/sca-java-2.x/trunk/modules/common-java/src/main/java/org/apache/tuscany/sca/common/java/io/IOHelper.java +++ b/sca-java-2.x/trunk/modules/common-java/src/main/java/org/apache/tuscany/sca/common/java/io/IOHelper.java @@ -147,4 +147,21 @@ public class IOHelper { return url; } + /** + * Returns a location string as a URL + * @param location + * @return + */ + public static URL getLocationAsURL(String location) { + URI uri = IOHelper.createURI(location); + if (uri.getScheme() == null) { + uri = new File(location).toURI(); + } + try { + return uri.toURL(); + } catch (MalformedURLException e) { + throw new IllegalArgumentException(location, e); + } + } + } |