AbstractHafasClientInterfaceProvider: Handle CGI_NO_SERVER error for all queries.

This commit is contained in:
Andreas Schildbach 2019-01-07 22:29:11 +01:00
parent 00e0074dc5
commit e2dafd2874

View file

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