From 0eb787866e2818c65eca76dd070771e809f9bdd2 Mon Sep 17 00:00:00 2001 From: "harald.bratko" Date: Tue, 28 Feb 2006 14:03:21 +0000 Subject: method makeAbsoluteURL does not work if URL starts with a protocol like "http://" or "file://". Fixed this. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@632 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/at/gv/egovernment/moa/util/FileUtils.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'common/src/at/gv/egovernment') diff --git a/common/src/at/gv/egovernment/moa/util/FileUtils.java b/common/src/at/gv/egovernment/moa/util/FileUtils.java index ae8d83834..a5e777c2d 100644 --- a/common/src/at/gv/egovernment/moa/util/FileUtils.java +++ b/common/src/at/gv/egovernment/moa/util/FileUtils.java @@ -99,14 +99,18 @@ public class FileUtils { 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(); + + if (url.startsWith("http:/") || url.startsWith("https:/") || url.startsWith("file:/") || url.startsWith("ftp:/")) { + return url; + } else { + // 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; } - return newURL; } } -- cgit v1.2.3