Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add validation for missing calls in SIRI update #5403

Merged

Conversation

vpaturet
Copy link
Contributor

@vpaturet vpaturet commented Oct 6, 2023

Summary

When a SIRI update creates a new trip without estimated calls, the update fails with the following error message:

Adding EstimatedJourney EstimatedVehicleJourney{EstimatedVehicleJourneyCode: 'GOA:ServiceJourney:20231003-921967', Operator: GOA:Operator:GOA, VehicleModes: [BUS], Line: GOA:Line:50} failed. java.lang.NullPointerException: null
	at java.base/java.util.Objects.requireNonNull(Objects.java:209)
	at java.base/java.util.ImmutableCollections.listFromArray(ImmutableCollections.java:190)
	at java.base/java.util.List.of(List.java:1047)
	at org.opentripplanner.transit.model.network.StopPattern.getStops(StopPattern.java:174)
	at org.opentripplanner.transit.model.network.TripPattern.getStops(TripPattern.java:199)
	at org.opentripplanner.transit.model.network.RoutingTripPattern.<init>(RoutingTripPattern.java:32)
	at org.opentripplanner.transit.model.network.TripPattern.<init>(TripPattern.java:103)
	at org.opentripplanner.transit.model.network.TripPatternBuilder.buildFromValues(TripPatternBuilder.java:117)
	at org.opentripplanner.transit.model.network.TripPatternBuilder.buildFromValues(TripPatternBuilder.java:17)
	at org.opentripplanner.transit.model.framework.AbstractBuilder.build(AbstractBuilder.java:29)
	at org.opentripplanner.ext.siri.AddedTripBuilder.build(AddedTripBuilder.java:190)
	at org.opentripplanner.ext.siri.SiriTimetableSnapshotSource.apply(SiriTimetableSnapshotSource.java:211)
	at org.opentripplanner.ext.siri.SiriTimetableSnapshotSource.applyEstimatedTimetable(SiriTimetableSnapshotSource.java:169)
	at org.opentripplanner.ext.siri.updater.SiriETGooglePubsubUpdater.lambda$processSiriData$0(SiriETGooglePubsubUpdater.java:380)
	at org.opentripplanner.updater.GraphUpdaterManager.lambda$execute$1(GraphUpdaterManager.java:192)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)

This PR ensures that the SIRI updater checks earlier in the process if the added trip has no call and reports a validation error.

@lassetyr should the validation reject as well EstimatedVehicleJourneys with less than 2 calls?

Issue

No

Unit tests

Added unit test

Documentation

No

@vpaturet vpaturet added the Bug label Oct 6, 2023
@vpaturet vpaturet self-assigned this Oct 6, 2023
@vpaturet vpaturet requested a review from lassetyr October 6, 2023 13:20
@vpaturet vpaturet added the Real-Time Update The issue/PR is related to RealTime updates label Oct 6, 2023
@vpaturet vpaturet marked this pull request as ready for review October 6, 2023 13:28
@vpaturet vpaturet requested a review from a team as a code owner October 6, 2023 13:28
@codecov
Copy link

codecov bot commented Oct 6, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (b0d9a18) 66.60% compared to head (5b8fa6b) 66.60%.

Additional details and impacted files
@@            Coverage Diff             @@
##             dev-2.x    #5403   +/-   ##
==========================================
  Coverage      66.60%   66.60%           
- Complexity     15279    15284    +5     
==========================================
  Files           1790     1790           
  Lines          69364    69371    +7     
  Branches        7306     7309    +3     
==========================================
+ Hits           46197    46205    +8     
  Misses         20690    20690           
+ Partials        2477     2476    -1     
Files Coverage Δ
...org/opentripplanner/ext/siri/AddedTripBuilder.java 73.58% <100.00%> (+1.21%) ⬆️

... and 1 file with indirect coverage changes

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

@vpaturet vpaturet force-pushed the fix_siri_missing_calls_validation branch from 626b3f9 to 5b8fa6b Compare October 6, 2023 14:57
@vpaturet
Copy link
Contributor Author

vpaturet commented Oct 6, 2023

@lassetyr I updated the validation to reject updates with less than 2 calls and those that refer to unknown stops.

@leonardehrenfried leonardehrenfried requested review from leonardehrenfried and removed request for leonardehrenfried October 10, 2023 10:07
@t2gran t2gran added this to the 2.5 (next release) milestone Oct 10, 2023
@vpaturet vpaturet added the Entur Test This is currently being tested at Entur label Oct 13, 2023
@vpaturet vpaturet merged commit 0d8ddcb into opentripplanner:dev-2.x Oct 16, 2023
t2gran pushed a commit that referenced this pull request Oct 16, 2023
@vpaturet vpaturet deleted the fix_siri_missing_calls_validation branch October 16, 2023 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Entur Test This is currently being tested at Entur Real-Time Update The issue/PR is related to RealTime updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants