Question about getBlockServiceDateFromTripUnCached Condition in BlockFinder.java

35 views
Skip to first unread message

kossavot

unread,
Apr 6, 2025, 7:21:48 AMApr 6
to OneBusAway API
HI oba team,

While investigating oba logs showing "could not determine service date for trip 30552027837449," I traced the issue to getBlockServiceDateFromTrip in BlockFinder.java. Specifically, this line:
java
BlockServiceDate blockServiceDate = getBlockServiceDateFromTripUnCached(tripEntry, currentTime);
returns null, which is then cached. (As an aside, should a null result be cached in this case?)
Digging deeper, the null originates in getBlockServiceDateFromTripUnCached. The condition:
java
if (adjustedTripStartTime > 0) {
fails because adjustedTripStartTime is 0. From what I can tell, this is correct behavior—0 aligns with the first trip in the block starting at midnight (00:00:00), which is valid per GTFS.
This made me wonder: shouldn’t the condition be if (adjustedTripStartTime >= 0) to include midnight starts? Excluding 0 seems to reject valid cases unnecessarily.
Any insights or suggestions on this? 
I’d appreciate your thoughts!

Best regards,
kossavot
 




Sheldon A. Brown

unread,
Apr 6, 2025, 12:57:34 PMApr 6
to onebusa...@googlegroups.com, OneBusAway API
What version and repo are you looking at?  That code was extensively reworked in the camsys fork. Be sure to compare against the most recent edits there. 
Sent from my iPhone

On Apr 6, 2025, at 07:21, kossavot <giorgio....@gmail.com> wrote:


--
You received this message because you are subscribed to the Google Groups "OneBusAway API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to onebusaway-ap...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/onebusaway-api/a0ce21c3-e652-49cf-b362-ce49a4e3adf9n%40googlegroups.com.

kossavot

unread,
Apr 6, 2025, 2:10:28 PMApr 6
to OneBusAway API
Hi Sheldon,

I'm sorry I forgot to mention that. Version I'm using is 2.5.12-cs from the camsys repo.
I've compared code with the unified branch and I don't see much difference around those functions.
 
Also, I've compared 2.5.12-cs with the main branch on the official repo and code seems to be pretty much identical.

Reply all
Reply to author
Forward
0 new messages