From 21fbce08f78884594fb7b7a9f77071a3d5158ab3 Mon Sep 17 00:00:00 2001 From: Andreas Schildbach Date: Sat, 1 Dec 2018 12:23:53 +0100 Subject: [PATCH] AbstractHafasClientInterfaceProvider: 'errTxt' is always optional. --- .../pte/AbstractHafasClientInterfaceProvider.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/enabler/src/de/schildbach/pte/AbstractHafasClientInterfaceProvider.java b/enabler/src/de/schildbach/pte/AbstractHafasClientInterfaceProvider.java index 194a981c..4c03315e 100644 --- a/enabler/src/de/schildbach/pte/AbstractHafasClientInterfaceProvider.java +++ b/enabler/src/de/schildbach/pte/AbstractHafasClientInterfaceProvider.java @@ -205,7 +205,7 @@ public abstract class AbstractHafasClientInterfaceProvider extends AbstractHafas checkState("LocGeoPos".equals(svcRes.getString("meth"))); final String err = svcRes.getString("err"); if (!"OK".equals(err)) { - final String errTxt = svcRes.getString("errTxt"); + final String errTxt = svcRes.optString("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); @@ -273,7 +273,7 @@ public abstract class AbstractHafasClientInterfaceProvider extends AbstractHafas checkState("StationBoard".equals(svcRes.getString("meth"))); final String err = svcRes.getString("err"); if (!"OK".equals(err)) { - final String errTxt = svcRes.getString("errTxt"); + final String errTxt = svcRes.optString("errTxt"); log.debug("Hafas error: {} {}", err, errTxt); if ("LOCATION".equals(err) && "HCI Service: location missing or invalid".equals(errTxt)) return new QueryDeparturesResult(header, QueryDeparturesResult.Status.INVALID_STATION); @@ -391,7 +391,7 @@ public abstract class AbstractHafasClientInterfaceProvider extends AbstractHafas checkState("LocMatch".equals(svcRes.getString("meth"))); final String err = svcRes.getString("err"); if (!"OK".equals(err)) { - final String errTxt = svcRes.getString("errTxt"); + final String errTxt = svcRes.optString("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);