mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-18 16:29:51 +00:00
AbstractHafasClientInterfaceProvider: Test for OK status of results in jsonTripSearchIdentify().
This commit is contained in:
parent
4e9ff4d9da
commit
a776a0ae89
1 changed files with 12 additions and 8 deletions
|
@ -434,17 +434,21 @@ public abstract class AbstractHafasClientInterfaceProvider extends AbstractHafas
|
|||
if (location.hasId())
|
||||
return location;
|
||||
if (location.hasName()) {
|
||||
final List<Location> locations = jsonLocMatch(JOINER.join(location.place, location.name), null, 1)
|
||||
.getLocations();
|
||||
final SuggestLocationsResult result = jsonLocMatch(JOINER.join(location.place, location.name), null, 1);
|
||||
if (result.status == SuggestLocationsResult.Status.OK) {
|
||||
final List<Location> locations = result.getLocations();
|
||||
if (!locations.isEmpty())
|
||||
return locations.get(0);
|
||||
}
|
||||
}
|
||||
if (location.hasCoord()) {
|
||||
final List<Location> locations = jsonLocGeoPos(EnumSet.allOf(LocationType.class), location.coord, 0,
|
||||
1).locations;
|
||||
final NearbyLocationsResult result = jsonLocGeoPos(EnumSet.allOf(LocationType.class), location.coord, 0, 1);
|
||||
if (result.status == NearbyLocationsResult.Status.OK) {
|
||||
final List<Location> locations = result.locations;
|
||||
if (!locations.isEmpty())
|
||||
return locations.get(0);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue