EFA: Parse message code when querying for locations via JSON.

This commit is contained in:
Andreas Schildbach 2015-11-29 23:17:56 +01:00
parent 94adb91a25
commit e60eabaa92
2 changed files with 17 additions and 0 deletions

View file

@ -285,6 +285,16 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
}
else
{
final JSONArray messages = stopFinder.getJSONArray("message");
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");
if (points != null)
{