aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/geocode
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/geocode')
-rw-r--r--src/org/traccar/geocode/JsonReverseGeocoder.java8
-rw-r--r--src/org/traccar/geocode/ReverseGeocoder.java4
2 files changed, 7 insertions, 5 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);
}
});
}
diff --git a/src/org/traccar/geocode/ReverseGeocoder.java b/src/org/traccar/geocode/ReverseGeocoder.java
index e2641fa37..b67ac50bb 100644
--- a/src/org/traccar/geocode/ReverseGeocoder.java
+++ b/src/org/traccar/geocode/ReverseGeocoder.java
@@ -19,7 +19,9 @@ public interface ReverseGeocoder {
interface ReverseGeocoderCallback {
- void onResult(String address);
+ void onSuccess(String address);
+
+ void onFailure(Throwable e);
}