schildbach / public-transport-enabler

Unleash public transport data in your Java project.
https://groups.google.com/forum/#!forum/public-transport-enabler-discuss
GNU General Public License v3.0
390 stars 133 forks source link

Navitia: No enum constant BSS_RENT #29

Closed schildbach closed 9 years ago

schildbach commented 9 years ago

When I was running ParisProviderLiveTest today, I got this:

java.lang.IllegalArgumentException: No enum constant de.schildbach.pte.AbstractNavitiaProvider.SectionType.BSS_RENT at java.lang.Enum.valueOf(Enum.java:238) at de.schildbach.pte.AbstractNavitiaProvider$SectionType.valueOf(AbstractNavitiaProvider.java:1) at de.schildbach.pte.AbstractNavitiaProvider.parseLeg(AbstractNavitiaProvider.java:459) at de.schildbach.pte.AbstractNavitiaProvider.parseQueryTripsResult(AbstractNavitiaProvider.java:571) at de.schildbach.pte.AbstractNavitiaProvider.queryTrips(AbstractNavitiaProvider.java:1107) at de.schildbach.pte.live.AbstractProviderLiveTest.queryTrips(AbstractProviderLiveTest.java:135) at de.schildbach.pte.live.ParisProviderLiveTest.queryTripSlowWalk(ParisProviderLiveTest.java:252)

aelkhour commented 9 years ago

This should not even happen, as the pte API does not support bike sharing system option... I can add the missing enums values to SectionType, but AbstractNavitiaProvider.parseLeg will still throw IllegalArgumentException if I don't handle new types such as BSS_RENT.

@schildbach do you consider this to be a suitable fix for now? We could always add bss support in pte later.

schildbach commented 9 years ago

Generally I like seeing exceptions if something is wrong. If the API returns something it should not return, it's an API bug and should be reported with Navitia I'd say. If they fix it, all is well. Only if they don't manage to fix it I would add code to ignore BSS_RENT values. For now, it seems to happen very rarely, so don't worry.

aelkhour commented 9 years ago

Agreed.

schildbach commented 9 years ago

Fixed in 92705c3ab17398e1b56419b0f1fd57d7b61a847d.