Skip to content

Improve handling of SIRI added trip with unresolvable agency#5931

Merged
vpaturet merged 1 commit into
opentripplanner:dev-2.xfrom
entur:fix_siri_journey_unresolvable_agency
Jul 9, 2024
Merged

Improve handling of SIRI added trip with unresolvable agency#5931
vpaturet merged 1 commit into
opentripplanner:dev-2.xfrom
entur:fix_siri_journey_unresolvable_agency

Conversation

@vpaturet
Copy link
Copy Markdown
Contributor

@vpaturet vpaturet commented Jun 27, 2024

Summary

When creating an extra-journey, the SIRI updater attempts to resolve the agency to which the trip belongs.
The algorithm does not always succeed in finding the agency. When it fails, it leads to a NullPointerException:

Adding EstimatedJourney EstimatedVehicleJourney{EstimatedVehicleJourneyCode: 'TRO:ServiceJourney:26_240524122635892_1084:3510509093', Operator: TRO:Operator:960, Line: TRO:Line:1_26} failed.
java.lang.NullPointerException: null
	at java.base/java.util.Objects.requireNonNull(Objects.java:233)
	at org.opentripplanner.transit.model.network.Route.<init>(Route.java:46)
	at org.opentripplanner.transit.model.network.RouteBuilder.buildFromValues(RouteBuilder.java:215)
	at org.opentripplanner.transit.model.network.RouteBuilder.buildFromValues(RouteBuilder.java:14)
	at org.opentripplanner.transit.model.framework.AbstractBuilder.build(AbstractBuilder.java:33)
	at org.opentripplanner.ext.siri.AddedTripBuilder.createRoute(AddedTripBuilder.java:308)
	at org.opentripplanner.ext.siri.AddedTripBuilder.build(AddedTripBuilder.java:175)
	at org.opentripplanner.ext.siri.SiriTimetableSnapshotSource.apply(SiriTimetableSnapshotSource.java:154)
	at org.opentripplanner.ext.siri.SiriTimetableSnapshotSource.lambda$applyEstimatedTimetable$1(SiriTimetableSnapshotSource.java:118)
	at org.opentripplanner.updater.trip.TimetableSnapshotManager.withLock(TimetableSnapshotManager.java:218)
	at org.opentripplanner.ext.siri.SiriTimetableSnapshotSource.applyEstimatedTimetable(SiriTimetableSnapshotSource.java:107)
	at org.opentripplanner.ext.siri.updater.EstimatedTimetableHandler.applyUpdate(EstimatedTimetableHandler.java:61)
	at org.opentripplanner.ext.siri.updater.AsyncEstimatedTimetableProcessor.lambda$processSiriData$0(AsyncEstimatedTimetableProcessor.java:38)
	at org.opentripplanner.updater.GraphUpdaterManager.lambda$execute$1(GraphUpdaterManager.java:192)

This PR handles this corner case by reporting a specific error message in this case.
(This will allow further analysis by reviewing error log messages)

Issue

No

Unit tests

Added unit test

Documentation

No

@vpaturet vpaturet added !Bug Apply to issues describing a bug and PRs witch fixes it. +Real-Time The issue/PR is related to RealTime updates labels Jun 27, 2024
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.45%. Comparing base (ce93c85) to head (d0ec77e).
Report is 2 commits behind head on dev-2.x.

Additional details and impacted files
@@            Coverage Diff             @@
##             dev-2.x    #5931   +/-   ##
==========================================
  Coverage      69.45%   69.45%           
- Complexity     17065    17072    +7     
==========================================
  Files           1934     1934           
  Lines          73624    73628    +4     
  Branches        7539     7540    +1     
==========================================
+ Hits           51134    51140    +6     
+ Misses         19866    19864    -2     
  Partials        2624     2624           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@vpaturet vpaturet force-pushed the fix_siri_journey_unresolvable_agency branch from c4cfc27 to 1e18a93 Compare June 27, 2024 08:04
@vpaturet vpaturet force-pushed the fix_siri_journey_unresolvable_agency branch from 1e18a93 to d0ec77e Compare June 27, 2024 08:54
@vpaturet vpaturet marked this pull request as ready for review June 27, 2024 09:00
@vpaturet vpaturet requested a review from a team as a code owner June 27, 2024 09:00
@vpaturet vpaturet self-assigned this Jun 27, 2024
@leonardehrenfried leonardehrenfried requested review from leonardehrenfried and t2gran and removed request for t2gran June 27, 2024 13:47
@vpaturet
Copy link
Copy Markdown
Contributor Author

@lassetyr we apply today some complex logic to "guess" the agency of an extra journey when its line or replaced line cannot be resolved.
Should extra journeys that do not refer to an existing line or existing replaced line simply be discarded?
What are the requirements in the Nordic SIRI profile?

@leonardehrenfried leonardehrenfried marked this pull request as draft July 2, 2024 08:56
Copy link
Copy Markdown
Member

@t2gran t2gran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code changes look ok, I have not looked at the business logic.

@vpaturet vpaturet marked this pull request as ready for review July 9, 2024 07:58
@vpaturet vpaturet merged commit 0237509 into opentripplanner:dev-2.x Jul 9, 2024
@vpaturet vpaturet deleted the fix_siri_journey_unresolvable_agency branch July 9, 2024 09:09
t2gran pushed a commit that referenced this pull request Jul 9, 2024
@t2gran t2gran added this to the 2.6 (next release) milestone Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

!Bug Apply to issues describing a bug and PRs witch fixes it. +Real-Time The issue/PR is related to RealTime updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants