mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-13 16:20:34 +00:00
EFA: Handle missing message code when querying for locations via JSON.
This commit is contained in:
parent
d12b1abd03
commit
35c82481b5
1 changed files with 10 additions and 7 deletions
|
@ -285,14 +285,17 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
final JSONArray messages = stopFinder.getJSONArray("message");
|
final JSONArray messages = stopFinder.optJSONArray("message");
|
||||||
for (int i = 0; i < messages.length(); i++)
|
if (messages != null)
|
||||||
{
|
{
|
||||||
final JSONObject message = messages.optJSONObject(i);
|
for (int i = 0; i < messages.length(); i++)
|
||||||
final String messageName = message.getString("name");
|
{
|
||||||
final String messageValue = Strings.emptyToNull(message.getString("value"));
|
final JSONObject message = messages.optJSONObject(i);
|
||||||
if ("code".equals(messageName) && !"-8011".equals(messageValue))
|
final String messageName = message.getString("name");
|
||||||
return new SuggestLocationsResult(header, SuggestLocationsResult.Status.SERVICE_DOWN);
|
final String messageValue = Strings.emptyToNull(message.getString("value"));
|
||||||
|
if ("code".equals(messageName) && !"-8011".equals(messageValue))
|
||||||
|
return new SuggestLocationsResult(header, SuggestLocationsResult.Status.SERVICE_DOWN);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final JSONObject points = stopFinder.optJSONObject("points");
|
final JSONObject points = stopFinder.optJSONObject("points");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue