Fixed non hierarchical URI of kustvakt conf files.
Change-Id: Iaa7a8cc0e56c6b5cbf451dd4f4058f1068aeb591
diff --git a/full/src/main/java/de/ids_mannheim/korap/server/KustvaktServer.java b/full/src/main/java/de/ids_mannheim/korap/server/KustvaktServer.java
index caf37e5..35879c8 100644
--- a/full/src/main/java/de/ids_mannheim/korap/server/KustvaktServer.java
+++ b/full/src/main/java/de/ids_mannheim/korap/server/KustvaktServer.java
@@ -2,6 +2,7 @@
import java.io.File;
import java.io.FileInputStream;
+import java.io.InputStream;
import java.net.URL;
import java.util.Properties;
@@ -25,15 +26,16 @@
kargs = server.readAttributes(args);
File f = new File("kustvakt.conf");
+ Properties properties = new Properties();
+
+ InputStream in = null;
if (!f.exists()){
- URL url = KustvaktServer.class.getResource("kustvakt.conf");
- if (url!=null){
- f = new File(url.toURI());
- }
+ in = KustvaktServer.class.getClassLoader().getResourceAsStream("kustvakt.conf");
+ }
+ else{
+ in = new FileInputStream(f);
}
- Properties properties = new Properties();
- FileInputStream in = new FileInputStream(f);
properties.load(in);
in.close();
fullConfig = new FullConfiguration(properties);
diff --git a/lite/src/main/java/de/ids_mannheim/korap/server/KustvaktLiteServer.java b/lite/src/main/java/de/ids_mannheim/korap/server/KustvaktLiteServer.java
index 123c1d1..54e80f9 100644
--- a/lite/src/main/java/de/ids_mannheim/korap/server/KustvaktLiteServer.java
+++ b/lite/src/main/java/de/ids_mannheim/korap/server/KustvaktLiteServer.java
@@ -2,6 +2,7 @@
import java.io.File;
import java.io.FileInputStream;
+import java.io.InputStream;
import java.net.URL;
import java.util.Properties;
@@ -18,15 +19,16 @@
if (kargs == null) System.exit(0);
File f = new File("kustvakt-lite.conf");
+ Properties properties = new Properties();
+ InputStream in = null;
+
if (!f.exists()){
- URL url = KustvaktLiteServer.class.getClassLoader().getResource("kustvakt-lite.conf");
- if (url!=null){
- f = new File(url.toURI());
- }
+ in = KustvaktLiteServer.class.getClassLoader().getResourceAsStream("kustvakt-lite.conf");
+ }
+ else{
+ in = new FileInputStream(f);
}
- Properties properties = new Properties();
- FileInputStream in = new FileInputStream(f);
properties.load(in);
in.close();
config = new KustvaktConfiguration(properties);