aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/Context.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/Context.java')
-rw-r--r--src/org/traccar/Context.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/org/traccar/Context.java b/src/org/traccar/Context.java
index 6c271c3ed..68558630d 100644
--- a/src/org/traccar/Context.java
+++ b/src/org/traccar/Context.java
@@ -20,6 +20,7 @@ import com.fasterxml.jackson.databind.SerializationFeature;
import com.ning.http.client.AsyncHttpClient;
import java.net.InetAddress;
+import java.net.UnknownHostException;
import java.util.Properties;
import org.apache.velocity.app.VelocityEngine;
@@ -238,7 +239,7 @@ public final class Context {
geocoder = new FactualGeocoder(url, key, cacheSize);
break;
case "geocodefarm":
- geocoder = new GeocodeFarmGeocoder(key, cacheSize);
+ geocoder = new GeocodeFarmGeocoder(key, language, cacheSize);
break;
default:
geocoder = new GoogleGeocoder(key, language, cacheSize);
@@ -288,9 +289,14 @@ public final class Context {
velocityProperties.setProperty("runtime.log.logsystem.class",
"org.apache.velocity.runtime.log.NullLogChute");
- String address = config.getString("web.address", InetAddress.getLocalHost().getHostAddress());
- int port = config.getInteger("web.port", 8082);
- String webUrl = URIUtil.newURI("http", address, port, "", "");
+ String address;
+ try {
+ address = config.getString("web.address", InetAddress.getLocalHost().getHostAddress());
+ } catch (UnknownHostException e) {
+ address = "localhost";
+ }
+
+ String webUrl = URIUtil.newURI("http", address, config.getInteger("web.port", 8082), "", "");
webUrl = Context.getConfig().getString("web.url", webUrl);
velocityProperties.setProperty("web.url", webUrl);