AbstractHafasClientInterfaceProvider: Handle CGI_READ_FAILED error in all queries.

This commit is contained in:
Andreas Schildbach 2018-12-01 12:30:52 +01:00
parent 21fbce08f7
commit a199d757d2

View file

@ -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");