diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-08-19 09:54:13 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2018-08-19 09:54:13 +1200 |
commit | 16c52142c0a28fbec61125cdad302ae11163096d (patch) | |
tree | 7d1e2559f48e36e74897c8bad81449a5067075d6 /src/org/traccar | |
parent | 5ac8ad35a823a7400a14376eb0ec24a4f5a9b7b8 (diff) | |
download | trackermap-server-16c52142c0a28fbec61125cdad302ae11163096d.tar.gz trackermap-server-16c52142c0a28fbec61125cdad302ae11163096d.tar.bz2 trackermap-server-16c52142c0a28fbec61125cdad302ae11163096d.zip |
Error message for disabled geocoding
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/api/resource/ServerResource.java | 6 |
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"); + } } } |