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
382 stars 133 forks source link

Navitia: Unhandled place type: on_demand_transport #123

Closed patkan closed 7 years ago

patkan commented 7 years ago

I have found a problem in the FranceNorthWest-Provider. Search a route from "La Villeneuve, Missillac" to "IUT, Rennes". It will yield in Transportr a toast telling me IllegalArgumentException: Unhandled place type: on_demand_transport.

After looking into the code I think the problem is that this is not implemented in the Navitia-provider. This type of transport is described in the Navitia-API-documentation.

I don't have the time at the moment to fix this, but for later or someone else: is this a problem that should be fixed in the NavitiaProvider or in the implementation which is in this case FranceNorthWestProvider? (Or am I misunderstanding something?)

grote commented 7 years ago

Thanks for debugging this!

Your last question is easier to answer when you post a stacktrace ;)

patkan commented 7 years ago

You are right. Crystal balls do not work well these days :-) This is the stacktrace of executing the mentioned request.

12-07 21:49:20.571 27313-27313/de.grobox.liberario.debug D/getLocationId: Found location: Location{STATION, stop_area:OPL:SA:AST-11231-A-11231-R, 47485636/-2156763, place=Missillac, name=La Villeneuve}
12-07 21:49:20.576 27313-27313/de.grobox.liberario.debug D/getLocationId: Found location: Location{STATION, stop_area:ORE:SA:1291, 48125147/-1633208, place=Rennes, name=IUT}
12-07 21:49:20.669 27313-29982/de.grobox.liberario.debug D/AsyncQueryTripsTask: From: Location{STATION, stop_area:OPL:SA:AST-11231-A-11231-R, 47485636/-2156763, place=Missillac, name=La Villeneuve}
12-07 21:49:20.669 27313-29982/de.grobox.liberario.debug D/AsyncQueryTripsTask: To: Location{STATION, stop_area:ORE:SA:1291, 48125147/-1633208, place=Rennes, name=IUT}
12-07 21:49:20.670 27313-29982/de.grobox.liberario.debug D/AsyncQueryTripsTask: Date: Wed Dec 07 21:49:20 MEZ 2016
12-07 21:49:20.670 27313-29982/de.grobox.liberario.debug D/AsyncQueryTripsTask: Optimize for: LEAST_DURATION
12-07 21:49:20.670 27313-29982/de.grobox.liberario.debug D/AsyncQueryTripsTask: Walk Speed: NORMAL

12-07 21:49:22.770 27313-29982/de.grobox.liberario.debug W/System.err: java.lang.IllegalArgumentException: Unhandled place type: on_demand_transport
12-07 21:49:22.782 27313-29982/de.grobox.liberario.debug W/System.err:     at de.schildbach.pte.AbstractNavitiaProvider.parseLeg(AbstractNavitiaProvider.java:543)
12-07 21:49:22.782 27313-29982/de.grobox.liberario.debug W/System.err:     at de.schildbach.pte.AbstractNavitiaProvider.parseQueryTripsResult(AbstractNavitiaProvider.java:565)
12-07 21:49:22.782 27313-29982/de.grobox.liberario.debug W/System.err:     at de.schildbach.pte.AbstractNavitiaProvider.queryTrips(AbstractNavitiaProvider.java:981)
12-07 21:49:22.782 27313-29982/de.grobox.liberario.debug W/System.err:     at de.grobox.liberario.tasks.AsyncQueryTripsTask.doInBackground(AsyncQueryTripsTask.java:112)
12-07 21:49:22.782 27313-29982/de.grobox.liberario.debug W/System.err:     at de.grobox.liberario.tasks.AsyncQueryTripsTask.doInBackground(AsyncQueryTripsTask.java:42)
12-07 21:49:22.782 27313-29982/de.grobox.liberario.debug W/System.err:     at android.os.AsyncTask$2.call(AsyncTask.java:292)
12-07 21:49:22.782 27313-29982/de.grobox.liberario.debug W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
12-07 21:49:22.782 27313-29982/de.grobox.liberario.debug W/System.err:     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
12-07 21:49:22.782 27313-29982/de.grobox.liberario.debug W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
12-07 21:49:22.782 27313-29982/de.grobox.liberario.debug W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
12-07 21:49:22.783 27313-29982/de.grobox.liberario.debug W/System.err:     at java.lang.Thread.run(Thread.java:818)
grote commented 7 years ago

Looks like the fix would be to add the unexpected place type on_demand_transport here: https://github.com/schildbach/public-transport-enabler/blob/master/enabler/src/de/schildbach/pte/AbstractNavitiaProvider.java#L468

patkan commented 7 years ago

Fixed by #125