OneBusAway / onebusaway-android

The official Android app for OneBusAway
http://www.onebusaway.org/
Other
484 stars 295 forks source link

Crash when tapping on stop that contains a forward slash "/" in stopId #704

Open barbeau opened 8 years ago

barbeau commented 8 years ago

Summary:

If you tap on a stop that has a / in the stopId, the app crashes with:

java.lang.IllegalArgumentException: Unknown URI: content://com.joulespersecond.oba/stops/1_Forge Park / 495

...once the ArrivalsListFragment calls setUserInfo() and the URI is queried in OBAProvider.queryInternal(). This particular URI falls through the switch statement which filters query types and generates an IllegalArgumentException.

Seems like client-side we should probably escape / as %2F - see http://stackoverflow.com/questions/2992231/slashes-in-url-variables.

Just opened server issue here as well - it's not clear that even if we escape the / client-side that servers can accept this in a REST API paramater : https://github.com/OneBusAway/onebusaway-application-modules/issues/182

Steps to reproduce:

  1. Using Boston OBA server, search for stop_code = Forge Park / 495
  2. Show stop on map and tap to see arrivals

I'm also guessing that even tapping on the stop in the search list will generate the exception (before you can show it on the map).

It has the following stopId: 1_Forge Park / 495

...and it can be seen in the list of stops returned in this stops-for-location query: http://developer.onebusaway.org/mbta-api/api/where/stops-for-location.json?lat=42.078482127189595&lon=-71.43382396548986&latSpan=0.08702002322407765&lonSpan=0.07993753999471664&version=2&key=TEST

Expected behavior:

Not crash and show arrival times for that stop

Encoded ID should be 1_Forge%20Park%20%2%20495

Observed behavior:

Crash

Device and Android version:

N/A

sharadagarwal commented 8 years ago

FYI, if the Android app is set to the Atlanta region and if you search for 431 and click on the route "GRTA_431 - BrandsMart/Stockbridge to Midtown", the app throws an error at the user. I suspect it is the same problem (in this case a route instead of a stop).

barbeau commented 8 years ago

Thanks @sharadagarwal! Good to know - given Atlanta is a production region I'll try to move this up in priority.

barbeau commented 8 years ago

Here are all known routes that suffer from the forward slash problem - they are all in Atlanta region (from @sharadagarwal - thanks!):

GRTA_411 - Hamilton Mill/Mall of Georgia to Midtown GRTA_413 - Hamilton Mill/Mall of Georgia to Downtown GRTA_414 - Ham. Mill/Mall of GA/Sugarloaf Mills to Mid GRTA_419 - Snellville/Hewatt Rd/Stone Mtn to Downtown GRTA_423 - E Conyers/W Conyers/Panola Road to Midtown GRTA_426 - E Conyers/W Conyers/Panola Road to Downtown GRTA_428 - West Conyers/Panola Road to Perimeter GRTA_431 - BrandsMart/Stockbridge to Midtown GRTA_432 - BrandsMart/Stockbridge to Downtown GRTA_440 - Hampton/Jonesboro to Downtown/Midtown GRTA_441 - Jonesboro to Downtown/Midtown GRTA_453 - Newnan/Union City to Downtown/Midtown GRTA_463 - W Douglas/Douglasville to Downtown/Midtown GRTA_476 - Hiram/Powder Springs to Downtown/Midtown GRTA_480 - Acworth/Town Center (Big Shanty) to Downtown GRTA_483 - Woodstock/Town Center(Big Shanty) to Midtown

barbeau commented 8 years ago

WIP at https://github.com/OneBusAway/onebusaway-android/pull/725.