AbstractHafasMobileProvider: Handle 'HCI Service: request failed' error in jsonLocGeoPos() and jsonLocMatch().

This commit is contained in:
Andreas Schildbach 2018-09-13 16:48:52 +02:00
parent 2c8e5ba9ec
commit b1624f6b0a

View file

@ -183,6 +183,9 @@ public abstract class AbstractHafasMobileProvider extends AbstractHafasProvider
final String err = svcRes.getString("err");
if (!"OK".equals(err)) {
final String errTxt = svcRes.getString("errTxt");
log.debug("Hafas error: {} {}", err, errTxt);
if ("FAIL".equals(err) && "HCI Service: request failed".equals(errTxt))
return new NearbyLocationsResult(header, NearbyLocationsResult.Status.SERVICE_DOWN);
throw new RuntimeException(err + " " + errTxt);
}
final JSONObject res = svcRes.getJSONObject("res");
@ -356,6 +359,9 @@ public abstract class AbstractHafasMobileProvider extends AbstractHafasProvider
final String err = svcRes.getString("err");
if (!"OK".equals(err)) {
final String errTxt = svcRes.getString("errTxt");
log.debug("Hafas error: {} {}", err, errTxt);
if ("FAIL".equals(err) && "HCI Service: request failed".equals(errTxt))
return new SuggestLocationsResult(header, SuggestLocationsResult.Status.SERVICE_DOWN);
throw new RuntimeException(err + " " + errTxt);
}
final JSONObject res = svcRes.getJSONObject("res");