aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/ReverseGeocoderHandler.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/ReverseGeocoderHandler.java')
-rw-r--r--src/org/traccar/ReverseGeocoderHandler.java19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/org/traccar/ReverseGeocoderHandler.java b/src/org/traccar/ReverseGeocoderHandler.java
index 88875fb3a..7304234cc 100644
--- a/src/org/traccar/ReverseGeocoderHandler.java
+++ b/src/org/traccar/ReverseGeocoderHandler.java
@@ -22,6 +22,7 @@ import org.jboss.netty.channel.Channels;
import org.jboss.netty.channel.MessageEvent;
import org.traccar.geocode.AddressFormat;
import org.traccar.geocode.ReverseGeocoder;
+import org.traccar.helper.Log;
import org.traccar.model.Position;
public class ReverseGeocoderHandler implements ChannelUpstreamHandler {
@@ -49,24 +50,30 @@ public class ReverseGeocoderHandler implements ChannelUpstreamHandler {
return;
}
- final MessageEvent e = (MessageEvent) evt;
- Object message = e.getMessage();
+ final MessageEvent event = (MessageEvent) evt;
+ Object message = event.getMessage();
if (message instanceof Position) {
final Position position = (Position) message;
if (processInvalidPositions || position.getValid()) {
geocoder.getAddress(addressFormat, position.getLatitude(), position.getLongitude(),
new ReverseGeocoder.ReverseGeocoderCallback() {
@Override
- public void onResult(String address) {
+ public void onSuccess(String address) {
position.setAddress(address);
- Channels.fireMessageReceived(ctx, position, e.getRemoteAddress());
+ Channels.fireMessageReceived(ctx, position, event.getRemoteAddress());
+ }
+
+ @Override
+ public void onFailure(Throwable e) {
+ Log.warning("Geocoding failed", e);
+ Channels.fireMessageReceived(ctx, position, event.getRemoteAddress());
}
});
} else {
- Channels.fireMessageReceived(ctx, position, e.getRemoteAddress());
+ Channels.fireMessageReceived(ctx, position, event.getRemoteAddress());
}
} else {
- Channels.fireMessageReceived(ctx, message, e.getRemoteAddress());
+ Channels.fireMessageReceived(ctx, message, event.getRemoteAddress());
}
}