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

Avoid NullPointerException in GTFS GraphQL API #6274

Merged

Conversation

leonardehrenfried
Copy link
Member

Summary

It fixes a NPE in BookingInfoImpl when minimumBookingNotice is null.

Issue

Closes #6273

Unit tests

Added. The reason that I didn't add a new file to GraphQLIntegrationTest is that only flex legs can currently have a booking info, which would require me to add a flex leg and update all assertion files.

Copy link

codecov bot commented Nov 25, 2024

Codecov Report

Attention: Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.

Project coverage is 69.75%. Comparing base (805e8d6) to head (91d6784).
Report is 75 commits behind head on dev-2.x.

Files with missing lines Patch % Lines
...planner/ext/restapi/mapping/BookingInfoMapper.java 0.00% 2 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #6274      +/-   ##
=============================================
+ Coverage      69.74%   69.75%   +0.01%     
- Complexity     17732    17742      +10     
=============================================
  Files           2010     2010              
  Lines          75923    75925       +2     
  Branches        7776     7776              
=============================================
+ Hits           52951    52962      +11     
+ Misses         20261    20255       -6     
+ Partials        2711     2708       -3     

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

@miklcct
Copy link
Contributor

miklcct commented Nov 26, 2024

Why do you say that only flex legs can have a booking info? It is recommended as long as a stop has pickup_type or drop_off_type as call agency, and this applies to scheduled service (e.g. coach services) as well.

@leonardehrenfried
Copy link
Member Author

leonardehrenfried commented Nov 26, 2024

In the GTFS spec you can put them anywhere but OTP only adds them to Flex legs. We can of course change that.

@leonardehrenfried leonardehrenfried changed the title Remove NullPointerException in GTFS GraphQL API Avoid NullPointerException in GTFS GraphQL API Nov 26, 2024
@leonardehrenfried leonardehrenfried merged commit c7fe2f2 into opentripplanner:dev-2.x Dec 2, 2024
5 checks passed
@leonardehrenfried leonardehrenfried deleted the booking-info-npe branch December 2, 2024 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OTP NPE when accessing maximumBookingNoticeSeconds
4 participants