CUTR-at-USF/bullrunner-gtfs-realtime-generator

Empty response from Syncromatics API

Closed this issue · 1 comments

In the method downloadVehiclesRouteC, we send a request to Syncromatics API for arrival prediction by vehicle. The response contains pattern name for the given vehicle and this helps us distinguish route C's vehicles from MSC Express' vehicles. However, the response is sometimes empty and causes the following bug:

2018-09-18 12:24:49,561 WARN  [GtfsRealtimeProviderImpl.java:442] : Error in vehicle refresh task
org.json.JSONException: JSONArray[0] not found.
	at org.json.JSONArray.get(JSONArray.java:234)
	at org.json.JSONArray.getJSONObject(JSONArray.java:326)
	at edu.usf.cutr.gtfs_realtime.bullrunner.GtfsRealtimeProviderImpl.downloadVehiclesRouteC(GtfsRealtimeProviderImpl.java:395)
	at edu.usf.cutr.gtfs_realtime.bullrunner.GtfsRealtimeProviderImpl.refreshTripVehicle(GtfsRealtimeProviderImpl.java:216)
	at edu.usf.cutr.gtfs_realtime.bullrunner.GtfsRealtimeProviderImpl.access$200(GtfsRealtimeProviderImpl.java:60)
	at edu.usf.cutr.gtfs_realtime.bullrunner.GtfsRealtimeProviderImpl$VehiclesRefreshTask.run(GtfsRealtimeProviderImpl.java:440)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

Note that this currently relates to the update-syncromatics-api branch, which isn't yet merged into master but is under development in #26.