Commit 36a34271 authored by Rafael Troilo's avatar Rafael Troilo
Browse files

change map to properties

parent c19e8894
......@@ -2,7 +2,7 @@ package org.heigit.ohsome.oshdb.helpers;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.Map;
import java.util.Properties;
import java.util.function.Consumer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
......@@ -45,7 +45,7 @@ public class OSHDBDriver {
* multithreading=true
* }</pre>
*/
public static void connect(Map<String, String> props, Consumer<OSHDBConnection> connect)
public static void connect(Properties props, Consumer<OSHDBConnection> connect)
throws Exception {
String oshdb = getInterpolated(props, "oshdb");
if (oshdb == null) {
......@@ -133,13 +133,13 @@ public class OSHDBDriver {
private static final Pattern substitute = Pattern.compile("\\$\\{(\\w+)\\}");
private static String getInterpolated(Map<String, String> props, String key) {
private static String getInterpolated(Properties props, String key) {
return getInterpolated(props, key, null);
}
private static String getInterpolated(Map<String, String> props, String key,
private static String getInterpolated(Properties props, String key,
String defaultValue) {
String value = props.get(key);
String value = props.getProperty(key);
if (value == null) {
return defaultValue;
}
......@@ -147,7 +147,7 @@ public class OSHDBDriver {
StringBuffer sb = new StringBuffer();
while (matcher.find()) {
String sub = matcher.group(1);
matcher.appendReplacement(sb, props.getOrDefault(sub, "\\${" + sub + "}"));
matcher.appendReplacement(sb, props.getProperty(sub, "\\${" + sub + "}"));
}
matcher.appendTail(sb);
return sb.toString();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment