EFA: Handle new <ers> error message in mobile XML API.

This commit is contained in:
Andreas Schildbach 2017-12-04 12:05:03 +01:00
parent 26e9b7be92
commit b45be823d9

View file

@ -1618,8 +1618,16 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider {
final ResultHeader header = enterEfa(pp);
final QueryDeparturesResult r = new QueryDeparturesResult(header);
XmlPullUtil.require(pp, "dps");
if (XmlPullUtil.optEnter(pp, "dps")) {
if (XmlPullUtil.optEnter(pp, "ers")) {
XmlPullUtil.enter(pp, "err");
final String mod = XmlPullUtil.valueTag(pp, "mod");
final String co = XmlPullUtil.valueTag(pp, "co");
XmlPullUtil.optValueTag(pp, "u", null);
XmlPullUtil.exit(pp, "err");
XmlPullUtil.exit(pp, "ers");
log.debug("EFA error: {} {}", co, mod);
result.set(new QueryDeparturesResult(header, QueryDeparturesResult.Status.SERVICE_DOWN));
} else if (XmlPullUtil.optEnter(pp, "dps")) {
final Calendar plannedDepartureTime = new GregorianCalendar(timeZone);
final Calendar predictedDepartureTime = new GregorianCalendar(timeZone);