From a199d757d2897652f5144bb7a09117965c8eaed3 Mon Sep 17 00:00:00 2001 From: Andreas Schildbach Date: Sat, 1 Dec 2018 12:30:52 +0100 Subject: [PATCH] AbstractHafasClientInterfaceProvider: Handle CGI_READ_FAILED error in all queries. --- .../pte/AbstractHafasClientInterfaceProvider.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/enabler/src/de/schildbach/pte/AbstractHafasClientInterfaceProvider.java b/enabler/src/de/schildbach/pte/AbstractHafasClientInterfaceProvider.java index 4c03315e..65f12b60 100644 --- a/enabler/src/de/schildbach/pte/AbstractHafasClientInterfaceProvider.java +++ b/enabler/src/de/schildbach/pte/AbstractHafasClientInterfaceProvider.java @@ -209,6 +209,8 @@ public abstract class AbstractHafasClientInterfaceProvider extends AbstractHafas log.debug("Hafas error: {} {}", err, errTxt); if ("FAIL".equals(err) && "HCI Service: request failed".equals(errTxt)) return new NearbyLocationsResult(header, NearbyLocationsResult.Status.SERVICE_DOWN); + if ("CGI_READ_FAILED".equals(err)) + return new NearbyLocationsResult(header, NearbyLocationsResult.Status.SERVICE_DOWN); throw new RuntimeException(err + " " + errTxt); } final JSONObject res = svcRes.getJSONObject("res"); @@ -279,6 +281,8 @@ public abstract class AbstractHafasClientInterfaceProvider extends AbstractHafas return new QueryDeparturesResult(header, QueryDeparturesResult.Status.INVALID_STATION); if ("FAIL".equals(err) && "HCI Service: request failed".equals(errTxt)) return new QueryDeparturesResult(header, QueryDeparturesResult.Status.SERVICE_DOWN); + if ("CGI_READ_FAILED".equals(err)) + return new QueryDeparturesResult(header, QueryDeparturesResult.Status.SERVICE_DOWN); throw new RuntimeException(err + " " + errTxt); } final JSONObject res = svcRes.getJSONObject("res"); @@ -395,6 +399,8 @@ public abstract class AbstractHafasClientInterfaceProvider extends AbstractHafas log.debug("Hafas error: {} {}", err, errTxt); if ("FAIL".equals(err) && "HCI Service: request failed".equals(errTxt)) return new SuggestLocationsResult(header, SuggestLocationsResult.Status.SERVICE_DOWN); + if ("CGI_READ_FAILED".equals(err)) + return new SuggestLocationsResult(header, SuggestLocationsResult.Status.SERVICE_DOWN); throw new RuntimeException(err + " " + errTxt); } final JSONObject res = svcRes.getJSONObject("res");