From e2dafd28746d376a83f63c2633c09232a419005b Mon Sep 17 00:00:00 2001 From: Andreas Schildbach Date: Mon, 7 Jan 2019 22:29:11 +0100 Subject: [PATCH] AbstractHafasClientInterfaceProvider: Handle CGI_NO_SERVER error for all queries. --- .../pte/AbstractHafasClientInterfaceProvider.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/enabler/src/de/schildbach/pte/AbstractHafasClientInterfaceProvider.java b/enabler/src/de/schildbach/pte/AbstractHafasClientInterfaceProvider.java index 07b25c91..4f40c1c4 100644 --- a/enabler/src/de/schildbach/pte/AbstractHafasClientInterfaceProvider.java +++ b/enabler/src/de/schildbach/pte/AbstractHafasClientInterfaceProvider.java @@ -256,6 +256,8 @@ public abstract class AbstractHafasClientInterfaceProvider extends AbstractHafas return new NearbyLocationsResult(header, NearbyLocationsResult.Status.SERVICE_DOWN); if ("CGI_READ_FAILED".equals(err)) return new NearbyLocationsResult(header, NearbyLocationsResult.Status.SERVICE_DOWN); + if ("CGI_NO_SERVER".equals(err)) + return new NearbyLocationsResult(header, NearbyLocationsResult.Status.SERVICE_DOWN); throw new RuntimeException(err + " " + errTxt); } final JSONObject res = svcRes.getJSONObject("res"); @@ -331,6 +333,8 @@ public abstract class AbstractHafasClientInterfaceProvider extends AbstractHafas return new QueryDeparturesResult(header, QueryDeparturesResult.Status.SERVICE_DOWN); if ("CGI_READ_FAILED".equals(err)) return new QueryDeparturesResult(header, QueryDeparturesResult.Status.SERVICE_DOWN); + if ("CGI_NO_SERVER".equals(err)) + return new QueryDeparturesResult(header, QueryDeparturesResult.Status.SERVICE_DOWN); throw new RuntimeException(err + " " + errTxt); } final JSONObject res = svcRes.getJSONObject("res"); @@ -460,6 +464,8 @@ public abstract class AbstractHafasClientInterfaceProvider extends AbstractHafas return new SuggestLocationsResult(header, SuggestLocationsResult.Status.SERVICE_DOWN); if ("CGI_READ_FAILED".equals(err)) return new SuggestLocationsResult(header, SuggestLocationsResult.Status.SERVICE_DOWN); + if ("CGI_NO_SERVER".equals(err)) + return new SuggestLocationsResult(header, SuggestLocationsResult.Status.SERVICE_DOWN); throw new RuntimeException(err + " " + errTxt); } final JSONObject res = svcRes.getJSONObject("res"); @@ -596,6 +602,8 @@ public abstract class AbstractHafasClientInterfaceProvider extends AbstractHafas return new QueryTripsResult(header, QueryTripsResult.Status.UNKNOWN_LOCATION); if ("CGI_READ_FAILED".equals(err)) return new QueryTripsResult(header, QueryTripsResult.Status.SERVICE_DOWN); + if ("CGI_NO_SERVER".equals(err)) + return new QueryTripsResult(header, QueryTripsResult.Status.SERVICE_DOWN); throw new RuntimeException(err + " " + errTxt); } final JSONObject res = svcRes.getJSONObject("res");