aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/api/resource
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-08-19 09:54:13 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2018-08-19 09:54:13 +1200
commit16c52142c0a28fbec61125cdad302ae11163096d (patch)
tree7d1e2559f48e36e74897c8bad81449a5067075d6 /src/org/traccar/api/resource
parent5ac8ad35a823a7400a14376eb0ec24a4f5a9b7b8 (diff)
downloadtrackermap-server-16c52142c0a28fbec61125cdad302ae11163096d.tar.gz
trackermap-server-16c52142c0a28fbec61125cdad302ae11163096d.tar.bz2
trackermap-server-16c52142c0a28fbec61125cdad302ae11163096d.zip
Error message for disabled geocoding
Diffstat (limited to 'src/org/traccar/api/resource')
-rw-r--r--src/org/traccar/api/resource/ServerResource.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/org/traccar/api/resource/ServerResource.java b/src/org/traccar/api/resource/ServerResource.java
index 61d3221f0..e7cad2a0c 100644
--- a/src/org/traccar/api/resource/ServerResource.java
+++ b/src/org/traccar/api/resource/ServerResource.java
@@ -53,7 +53,11 @@ public class ServerResource extends BaseResource {
@Path("geocode")
@GET
public String geocode(@QueryParam("latitude") double latitude, @QueryParam("longitude") double longitude) {
- return Context.getGeocoder().getAddress(latitude, longitude, null);
+ if (Context.getGeocoder() != null) {
+ return Context.getGeocoder().getAddress(latitude, longitude, null);
+ } else {
+ throw new RuntimeException("Reverse geocoding is not enabled");
+ }
}
}