summaryrefslogtreecommitdiff
path: root/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/FileUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/FileUtils.java')
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/FileUtils.java36
1 files changed, 34 insertions, 2 deletions
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/FileUtils.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/FileUtils.java
index 01fb7375..f458c142 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/FileUtils.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/FileUtils.java
@@ -1,4 +1,28 @@
/*******************************************************************************
+ * Copyright 2017 Graz University of Technology
+ * EAAF-Core Components has been developed in a cooperation between EGIZ,
+ * A-SIT+, A-SIT, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ *******************************************************************************/
+/*******************************************************************************
+ *******************************************************************************/
+/*******************************************************************************
*******************************************************************************/
@@ -15,6 +39,8 @@ import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
+import org.apache.commons.lang3.StringUtils;
+
/**
* Utility for accessing files on the file system, and for reading from input streams.
* @author Paul Ivancsics
@@ -70,7 +96,10 @@ public class FileUtils {
* @throws MalformedURLException
*/
public static String makeAbsoluteURL(String url, URI root) throws MalformedURLException {
- return makeAbsoluteURL(url, root.toURL().toString());
+ if (root != null)
+ return makeAbsoluteURL(url, root.toURL().toString());
+ else
+ return makeAbsoluteURL(url, StringUtils.EMPTY);
}
@@ -83,9 +112,12 @@ public class FileUtils {
public static String makeAbsoluteURL(String url, String root) {
//if url is relative to rootConfigFileDirName make it absolute
+ if (StringUtils.isEmpty(root))
+ root = null;
+
File keyFile;
String newURL = url;
-
+
if(null == url) return null;
if (url.startsWith("http:/") || url.startsWith("https:/") || url.startsWith("file:/") || url.startsWith("ftp:/")) {