mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-15 17:10:30 +00:00
Fix exception when parsing type 'buildingname' in JSON stopfinder (EFA).
This commit is contained in:
parent
00b9456431
commit
c11a23ba08
1 changed files with 6 additions and 5 deletions
|
@ -294,7 +294,8 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
String type = stop.getString("type");
|
||||
if ("any".equals(type))
|
||||
type = stop.getString("anyType");
|
||||
final String name = normalizeLocationName(stop.getString("object"));
|
||||
final String name = normalizeLocationName(stop.optString("name"));
|
||||
final String object = normalizeLocationName(stop.optString("object"));
|
||||
final int quality = stop.getInt("quality");
|
||||
final JSONObject ref = stop.getJSONObject("ref");
|
||||
String place = ref.getString("place");
|
||||
|
@ -317,13 +318,13 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
|
||||
final Location location;
|
||||
if ("stop".equals(type))
|
||||
location = new Location(LocationType.STATION, stop.getString("stateless"), lat, lon, place, name);
|
||||
location = new Location(LocationType.STATION, stop.getString("stateless"), lat, lon, place, object);
|
||||
else if ("poi".equals(type))
|
||||
location = new Location(LocationType.POI, null, lat, lon, place, name);
|
||||
location = new Location(LocationType.POI, null, lat, lon, place, object);
|
||||
else if ("crossing".equals(type))
|
||||
location = new Location(LocationType.ADDRESS, null, lat, lon, place, name);
|
||||
location = new Location(LocationType.ADDRESS, null, lat, lon, place, object);
|
||||
else if ("street".equals(type) || "address".equals(type) || "singlehouse".equals(type) || "buildingname".equals(type))
|
||||
location = new Location(LocationType.ADDRESS, null, lat, lon, place, normalizeLocationName(stop.getString("name")));
|
||||
location = new Location(LocationType.ADDRESS, null, lat, lon, place, name);
|
||||
else
|
||||
throw new JSONException("unknown type: " + type);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue