From 93d750a57b7ecdcad6e62bf75b97e804d7f45eac Mon Sep 17 00:00:00 2001
From: Oliver Schramm <oliver.schramm97@gmail.com>
Date: Thu, 24 Jun 2021 19:44:46 +0200
Subject: Catch all webexceptions in JsonGeocoder

When a service is down (like positionstack recently often is),
it might send a 503 Service Unavailable which is not covered
by a ClientErrorException. Using the superclass of this, will
enable the position to be handled correctly still.
---
 src/main/java/org/traccar/geocoder/JsonGeocoder.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/main/java/org')

diff --git a/src/main/java/org/traccar/geocoder/JsonGeocoder.java b/src/main/java/org/traccar/geocoder/JsonGeocoder.java
index 4f34fb973..3cd5b596e 100644
--- a/src/main/java/org/traccar/geocoder/JsonGeocoder.java
+++ b/src/main/java/org/traccar/geocoder/JsonGeocoder.java
@@ -22,7 +22,7 @@ import org.traccar.Main;
 import org.traccar.database.StatisticsManager;
 
 import javax.json.JsonObject;
-import javax.ws.rs.ClientErrorException;
+import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.client.Invocation;
 import javax.ws.rs.client.InvocationCallback;
 import java.util.AbstractMap;
@@ -116,7 +116,7 @@ public abstract class JsonGeocoder implements Geocoder {
         } else {
             try {
                 return handleResponse(latitude, longitude, request.get(JsonObject.class), null);
-            } catch (ClientErrorException e) {
+            } catch (WebApplicationException e) {
                 LOGGER.warn("Geocoder network error", e);
             }
         }
-- 
cgit v1.2.3