grote / Transportr

Free Public Transport Assistant without Ads or Tracking
https://transportr.app
GNU General Public License v3.0
1.05k stars 188 forks source link

Error with walkspeed management #619

Closed Josue-T closed 5 years ago

Josue-T commented 5 years ago

Problem

Sometime we get an error when we try to get the timetable from the SBB API. I firstly thought that it's caused by "public-transport-enabler". I made an issue on this side here:

https://github.com/schildbach/public-transport-enabler/issues/273

From the answer I understood that, it's an issue on the transportr side.

To Reproduce

  1. Use the SBB network
  2. Request the timetable from "Aigle" to "Fribourg" by example.
  3. See the error

On my side I get this stacktrace:

07-09 14:38:01.503 27283 27283 I TripsRepository: From: Location{STATION, 8501400, 46.3168480/6.9636650, name=Aigle}
07-09 14:38:01.503 27283 27283 I TripsRepository: Via: null
07-09 14:38:01.503 27283 27283 I TripsRepository: To: Location{STATION, 178, 46.8032720/7.1510270, name=Fribourg}
07-09 14:38:01.503 27283 27283 I TripsRepository: Date: Tue Jul 09 14:38:01 GMT+02:00 2019
07-09 14:38:01.503 27283 27283 I TripsRepository: Departure: true
07-09 14:38:01.503 27283 27283 I TripsRepository: Products: [HIGH_SPEED_TRAIN, REGIONAL_TRAIN, SUBURBAN_TRAIN, SUBWAY, TRAM, BUS, FERRY, CABLECAR, ON_DEMAND]
07-09 14:38:01.503 27283 27283 I TripsRepository: Optimize for: LEAST_DURATION
07-09 14:38:01.504 27283 27283 W System.err: java.lang.IllegalArgumentException: No enum constant de.schildbach.pte.NetworkProvider.WalkSpeed.normal
07-09 14:38:01.512 27283 27283 W System.err:    at java.lang.Enum.valueOf(Enum.java:254)
07-09 14:38:01.512 27283 27283 W System.err:    at de.schildbach.pte.NetworkProvider$WalkSpeed.valueOf(NetworkProvider.java:59)
07-09 14:38:01.512 27283 27283 W System.err:    at de.grobox.transportr.settings.SettingsManager.getWalkSpeed(SettingsManager.kt:71)
07-09 14:38:01.512 27283 27283 W System.err:    at de.grobox.transportr.trips.search.TripsRepository.search(TripsRepository.kt:92)
07-09 14:38:01.512 27283 27283 W System.err:    at de.grobox.transportr.trips.search.DirectionsViewModel.search(DirectionsViewModel.java:234)
07-09 14:38:01.512 27283 27283 W System.err:    at de.grobox.transportr.trips.search.TripsFragment.lambda$onCreateView$0$TripsFragment(TripsFragment.java:104)
07-09 14:38:01.512 27283 27283 W System.err:    at de.grobox.transportr.trips.search.-$$Lambda$TripsFragment$KANGsEXaMiBMG_Yjj7Iwk-eYHfU.onClick(lambda)
07-09 14:38:01.512 27283 27283 W System.err:    at android.view.View.performClick(View.java:5637)
07-09 14:38:01.512 27283 27283 W System.err:    at android.view.View$PerformClick.run(View.java:22433)
07-09 14:38:01.512 27283 27283 W System.err:    at android.os.Handler.handleCallback(Handler.java:751)
07-09 14:38:01.512 27283 27283 W System.err:    at android.os.Handler.dispatchMessage(Handler.java:95)
07-09 14:38:01.512 27283 27283 W System.err:    at android.os.Looper.loop(Looper.java:154)
07-09 14:38:01.512 27283 27283 W System.err:    at android.app.ActivityThread.main(ActivityThread.java:6186)
07-09 14:38:01.512 27283 27283 W System.err:    at java.lang.reflect.Method.invoke(Native Method)
07-09 14:38:01.513 27283 27283 W System.err:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
07-09 14:38:01.513 27283 27283 W System.err:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
07-09 14:38:01.513 27283 27283 I TripsRepository: Walk Speed: NORMAL
07-09 14:38:01.555 27283 29321 W System.err: java.lang.IllegalArgumentException: No enum constant de.schildbach.pte.NetworkProvider.WalkSpeed.normal
07-09 14:38:01.555 27283 29321 W System.err:    at java.lang.Enum.valueOf(Enum.java:254)
07-09 14:38:01.555 27283 29321 W System.err:    at de.schildbach.pte.NetworkProvider$WalkSpeed.valueOf(NetworkProvider.java:59)
07-09 14:38:01.555 27283 29321 W System.err:    at de.grobox.transportr.settings.SettingsManager.getWalkSpeed(SettingsManager.kt:71)
07-09 14:38:01.555 27283 29321 W System.err:    at de.grobox.transportr.trips.search.TripsRepository.queryTrips(TripsRepository.kt:105)
07-09 14:38:01.555 27283 29321 W System.err:    at de.grobox.transportr.trips.search.TripsRepository.access$queryTrips(TripsRepository.kt:46)
07-09 14:38:01.555 27283 29321 W System.err:    at de.grobox.transportr.trips.search.TripsRepository$search$1.invoke(TripsRepository.kt:97)
07-09 14:38:01.555 27283 29321 W System.err:    at de.grobox.transportr.trips.search.TripsRepository$search$1.invoke(TripsRepository.kt:46)
07-09 14:38:01.556 27283 29321 W System.err:    at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)

Following of answer of from the public-transport-enabler, it's not a big issue. Here is the answer:

Your mistake is in the posted stack trace:

No enum constant de.schildbach.pte.NetworkProvider.WalkSpeed.normal

Uppercase the constant and your code should work.

Versions (please complete the following information):

ialokim commented 5 years ago

This error is quite strange, I was not able to reproduce it. Could you recheck the installed version of Transportr and try to switch to another walk speed in the settings, switch back again and report on here if the error still persists?

Josue-T commented 5 years ago

Well, I have removed the app and reinstalled. Now I'm not able to reproduce the bug. So I close this issue. I'll reopen it if got a new time this error.