diff options
Diffstat (limited to 'common/src')
-rw-r--r-- | common/src/at/gv/egovernment/moa/util/FileUtils.java | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/common/src/at/gv/egovernment/moa/util/FileUtils.java b/common/src/at/gv/egovernment/moa/util/FileUtils.java index bb21f4ca0..ae8d83834 100644 --- a/common/src/at/gv/egovernment/moa/util/FileUtils.java +++ b/common/src/at/gv/egovernment/moa/util/FileUtils.java @@ -1,11 +1,10 @@ package at.gv.egovernment.moa.util; import java.io.BufferedInputStream; +import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; -import java.net.URI; -import java.net.URISyntaxException; import java.net.URL; /** @@ -95,17 +94,19 @@ public class FileUtils { */ public static String makeAbsoluteURL(String url, String root) { //if url is relative to rootConfigFileDirName make it absolute - try { - if(null == url) return null; - URI uri = new URI(url); - if (!uri.isAbsolute()) { // make it absolute to the config file - uri = new URI(root + url); - } - return uri.toString(); - } catch (URISyntaxException e) { - //if url string could not be converted to absolute URL return source url - return url; - } + + File keyFile; + String newURL = url; + + if(null == url) return null; + + // check if absolute - if not make it absolute + keyFile = new File(url); + if (!keyFile.isAbsolute()) { + keyFile = new File(root, url); + newURL = keyFile.getPath(); + } + return newURL; } } |