Hafas: Handle JSON API error H9380 'Departure/Arrival/Intermediate or equivalent stations def'd more than once'.

This commit is contained in:
Andreas Schildbach 2016-03-10 19:14:18 +01:00
parent b3965275fb
commit 907fc38dc4
2 changed files with 10 additions and 0 deletions

View file

@ -1197,6 +1197,8 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
return new QueryTripsResult(header, QueryTripsResult.Status.UNRESOLVABLE_ADDRESS); return new QueryTripsResult(header, QueryTripsResult.Status.UNRESOLVABLE_ADDRESS);
if ("H9360".equals(err)) // Date outside of the timetable period. if ("H9360".equals(err)) // Date outside of the timetable period.
return new QueryTripsResult(header, QueryTripsResult.Status.INVALID_DATE); return new QueryTripsResult(header, QueryTripsResult.Status.INVALID_DATE);
if ("H9380".equals(err)) // Departure/Arrival/Intermediate or equivalent stations def'd more than once.
return new QueryTripsResult(header, QueryTripsResult.Status.TOO_CLOSE);
final String errTxt = svcRes.getString("errTxt"); final String errTxt = svcRes.getString("errTxt");
throw new RuntimeException(err + ": " + errTxt); throw new RuntimeException(err + ": " + errTxt);
} }

View file

@ -123,4 +123,12 @@ public class ShProviderLiveTest extends AbstractProviderLiveTest
new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL); new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
print(result); print(result);
} }
@Test
public void trip_errorTooClose() throws Exception
{
final Location station = new Location(LocationType.STATION, "003665026");
final QueryTripsResult result = queryTrips(station, null, station, new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
assertEquals(QueryTripsResult.Status.TOO_CLOSE, result.status);
}
} }