aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-06-14 16:26:26 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2018-06-14 16:26:26 +1200
commita20b967182f824b98dd39d3e85294fe3d0a7d0d4 (patch)
tree118e9ccec14eef70eb576a77ffabb7cb0c1accbb /src/org
parent220a912c1b4f12c4ad0d229e91ed9fd72f4aa327 (diff)
downloadtraccar-server-a20b967182f824b98dd39d3e85294fe3d0a7d0d4.tar.gz
traccar-server-a20b967182f824b98dd39d3e85294fe3d0a7d0d4.tar.bz2
traccar-server-a20b967182f824b98dd39d3e85294fe3d0a7d0d4.zip
Catch request exceptions (fix #3905)
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/geocoder/JsonGeocoder.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/org/traccar/geocoder/JsonGeocoder.java b/src/org/traccar/geocoder/JsonGeocoder.java
index e06663689..36a3acb76 100644
--- a/src/org/traccar/geocoder/JsonGeocoder.java
+++ b/src/org/traccar/geocoder/JsonGeocoder.java
@@ -19,6 +19,7 @@ import org.traccar.Context;
import org.traccar.helper.Log;
import javax.json.JsonObject;
+import javax.ws.rs.ClientErrorException;
import javax.ws.rs.client.Invocation;
import javax.ws.rs.client.InvocationCallback;
import java.util.AbstractMap;
@@ -62,8 +63,9 @@ public abstract class JsonGeocoder implements Geocoder {
} else {
if (callback != null) {
callback.onFailure(new GeocoderException("Empty address"));
+ } else {
+ Log.warning("Empty address");
}
- Log.warning("Empty address");
}
return null;
}
@@ -88,7 +90,7 @@ public abstract class JsonGeocoder implements Geocoder {
request.async().get(new InvocationCallback<JsonObject>() {
@Override
public void completed(JsonObject json) {
- callback.onSuccess(handleResponse(latitude, longitude, json, callback));
+ handleResponse(latitude, longitude, json, callback);
}
@Override
@@ -97,7 +99,11 @@ public abstract class JsonGeocoder implements Geocoder {
}
});
} else {
- return handleResponse(latitude, longitude, request.get(JsonObject.class), null);
+ try {
+ return handleResponse(latitude, longitude, request.get(JsonObject.class), null);
+ } catch (ClientErrorException e) {
+ Log.warning(e);
+ }
}
return null;
}