mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-13 08:10:46 +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
|
||||
{
|
||||
final JSONArray messages = stopFinder.getJSONArray("message");
|
||||
for (int i = 0; i < messages.length(); i++)
|
||||
final JSONArray messages = stopFinder.optJSONArray("message");
|
||||
if (messages != null)
|
||||
{
|
||||
final JSONObject message = messages.optJSONObject(i);
|
||||
final String messageName = message.getString("name");
|
||||
final String messageValue = Strings.emptyToNull(message.getString("value"));
|
||||
if ("code".equals(messageName) && !"-8011".equals(messageValue))
|
||||
return new SuggestLocationsResult(header, SuggestLocationsResult.Status.SERVICE_DOWN);
|
||||
for (int i = 0; i < messages.length(); i++)
|
||||
{
|
||||
final JSONObject message = messages.optJSONObject(i);
|
||||
final String messageName = message.getString("name");
|
||||
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");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue