aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/geocode/JsonReverseGeocoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-12-31 11:17:50 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-12-31 11:17:50 +1300
commitd13f618ee3b8463d063b7f67e039299560245597 (patch)
treea59177abc8a4f9c74680dd15b3d1c6c0c1231c9d /src/org/traccar/geocode/JsonReverseGeocoder.java
parent2c6c6eccf2c45bf87e16c45e3bac9872f53c12c3 (diff)
downloadtrackermap-server-d13f618ee3b8463d063b7f67e039299560245597.tar.gz
trackermap-server-d13f618ee3b8463d063b7f67e039299560245597.tar.bz2
trackermap-server-d13f618ee3b8463d063b7f67e039299560245597.zip
Implement geocoding error handling
Diffstat (limited to 'src/org/traccar/geocode/JsonReverseGeocoder.java')
-rw-r--r--src/org/traccar/geocode/JsonReverseGeocoder.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/org/traccar/geocode/JsonReverseGeocoder.java b/src/org/traccar/geocode/JsonReverseGeocoder.java
index c107d24e8..d3661b53c 100644
--- a/src/org/traccar/geocode/JsonReverseGeocoder.java
+++ b/src/org/traccar/geocode/JsonReverseGeocoder.java
@@ -53,7 +53,7 @@ public abstract class JsonReverseGeocoder implements ReverseGeocoder {
if (cache != null) {
String cachedAddress = cache.get(new AbstractMap.SimpleImmutableEntry<>(latitude, longitude));
if (cachedAddress != null) {
- callback.onResult(cachedAddress);
+ callback.onSuccess(cachedAddress);
return;
}
}
@@ -69,9 +69,9 @@ public abstract class JsonReverseGeocoder implements ReverseGeocoder {
if (cache != null) {
cache.put(new AbstractMap.SimpleImmutableEntry<>(latitude, longitude), formattedAddress);
}
- callback.onResult(formattedAddress);
+ callback.onSuccess(formattedAddress);
} else {
- callback.onResult(null);
+ callback.onFailure(new IllegalArgumentException("Empty address"));
}
}
return null;
@@ -79,7 +79,7 @@ public abstract class JsonReverseGeocoder implements ReverseGeocoder {
@Override
public void onThrowable(Throwable t) {
- callback.onResult(null);
+ callback.onFailure(t);
}
});
}