AbstractHafasClientInterfaceProvider: Handle H_UNKNOWN error for all queries.

This commit is contained in:
Andreas Schildbach 2019-10-28 13:51:45 +01:00
parent 330fccb61b
commit 0f6862f87a

View file

@ -265,6 +265,8 @@ public abstract class AbstractHafasClientInterfaceProvider extends AbstractHafas
return new NearbyLocationsResult(header, NearbyLocationsResult.Status.SERVICE_DOWN); return new NearbyLocationsResult(header, NearbyLocationsResult.Status.SERVICE_DOWN);
if ("CGI_NO_SERVER".equals(err)) if ("CGI_NO_SERVER".equals(err))
return new NearbyLocationsResult(header, NearbyLocationsResult.Status.SERVICE_DOWN); return new NearbyLocationsResult(header, NearbyLocationsResult.Status.SERVICE_DOWN);
if ("H_UNKNOWN".equals(err))
return new NearbyLocationsResult(header, NearbyLocationsResult.Status.SERVICE_DOWN);
throw new RuntimeException(err + " " + errTxt); throw new RuntimeException(err + " " + errTxt);
} }
final JSONObject res = svcRes.getJSONObject("res"); final JSONObject res = svcRes.getJSONObject("res");
@ -352,6 +354,8 @@ public abstract class AbstractHafasClientInterfaceProvider extends AbstractHafas
return new QueryDeparturesResult(header, QueryDeparturesResult.Status.SERVICE_DOWN); return new QueryDeparturesResult(header, QueryDeparturesResult.Status.SERVICE_DOWN);
if ("CGI_NO_SERVER".equals(err)) if ("CGI_NO_SERVER".equals(err))
return new QueryDeparturesResult(header, QueryDeparturesResult.Status.SERVICE_DOWN); return new QueryDeparturesResult(header, QueryDeparturesResult.Status.SERVICE_DOWN);
if ("H_UNKNOWN".equals(err))
return new QueryDeparturesResult(header, QueryDeparturesResult.Status.SERVICE_DOWN);
throw new RuntimeException(err + " " + errTxt); throw new RuntimeException(err + " " + errTxt);
} }
final JSONObject res = svcRes.getJSONObject("res"); final JSONObject res = svcRes.getJSONObject("res");
@ -487,6 +491,8 @@ public abstract class AbstractHafasClientInterfaceProvider extends AbstractHafas
return new SuggestLocationsResult(header, SuggestLocationsResult.Status.SERVICE_DOWN); return new SuggestLocationsResult(header, SuggestLocationsResult.Status.SERVICE_DOWN);
if ("CGI_NO_SERVER".equals(err)) if ("CGI_NO_SERVER".equals(err))
return new SuggestLocationsResult(header, SuggestLocationsResult.Status.SERVICE_DOWN); return new SuggestLocationsResult(header, SuggestLocationsResult.Status.SERVICE_DOWN);
if ("H_UNKNOWN".equals(err))
return new SuggestLocationsResult(header, SuggestLocationsResult.Status.SERVICE_DOWN);
throw new RuntimeException(err + " " + errTxt); throw new RuntimeException(err + " " + errTxt);
} }
final JSONObject res = svcRes.getJSONObject("res"); final JSONObject res = svcRes.getJSONObject("res");
@ -627,6 +633,8 @@ public abstract class AbstractHafasClientInterfaceProvider extends AbstractHafas
return new QueryTripsResult(header, QueryTripsResult.Status.SERVICE_DOWN); return new QueryTripsResult(header, QueryTripsResult.Status.SERVICE_DOWN);
if ("CGI_NO_SERVER".equals(err)) if ("CGI_NO_SERVER".equals(err))
return new QueryTripsResult(header, QueryTripsResult.Status.SERVICE_DOWN); return new QueryTripsResult(header, QueryTripsResult.Status.SERVICE_DOWN);
if ("H_UNKNOWN".equals(err))
return new QueryTripsResult(header, QueryTripsResult.Status.SERVICE_DOWN);
throw new RuntimeException(err + " " + errTxt); throw new RuntimeException(err + " " + errTxt);
} }
final JSONObject res = svcRes.getJSONObject("res"); final JSONObject res = svcRes.getJSONObject("res");