diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2010-05-23 09:05:08 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2010-05-23 09:05:08 +0000 |
commit | f6ec03553486145943248e78a7010f96b13204d6 (patch) | |
tree | 8f7b31f5cc0b387b66b6babaf3d346f20dfc72e7 /sca-java-2.x/trunk/modules | |
parent | 3e8a278fd8ec6161e8c23b977c682dca024a53d1 (diff) |
Add a getLocationAsURL helper method
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@947383 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules')
-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); + } + } + } |