Skip to content

Fix NullPointerException in stop transfer priority cost vector generation - #5943

Merged
t2gran merged 5 commits into
opentripplanner:dev-2.xfrom
entur:otp2_fix_npe_stop_tx_cost
Jul 4, 2024
Merged

Fix NullPointerException in stop transfer priority cost vector generation#5943
t2gran merged 5 commits into
opentripplanner:dev-2.xfrom
entur:otp2_fix_npe_stop_tx_cost

Conversation

@t2gran

@t2gran t2gran commented Jul 3, 2024

Copy link
Copy Markdown
Member

Summary

In some cases (transit period filtering) stops can be dropped after they are created. This causes the stop-index(used in routing) to contain holes in it. This happens because the stop index is assigned to a stop when it is created. In this PR, I have gone over the code to make sure holes in the stop-index is handled correctly and no NPE is thrown.

Issue

After enabling stopBoardAlightDuringTransferCost I got NPE locally during testing of OTP. This fixes the NPE in TransitLayerMapper and cleans up the code a bit.

Unit tests

🟥 I have not added any unit-tests for this. Instead I chose to improve logging and annotated with @Nullable in the appropriate place.

Documentation

🟥 I have just updated the JaveDoc - if relevant.

Changelog

✅ This is a minor bug fix.

Bumping the serialization version id

✅ The order of the StopTransferPriority enums are changed. This may have an effect on the serialization.

@t2gran t2gran added !Bug Apply to issues describing a bug and PRs witch fixes it. +Bump Serialization Id Add this label if you want the serialization id automatically bumped after merging the PR labels Jul 3, 2024
@t2gran t2gran added this to the 2.6 (next release) milestone Jul 3, 2024
@t2gran
t2gran requested a review from a team as a code owner July 3, 2024 09:25
Comment thread src/main/java/org/opentripplanner/transit/service/StopModelIndex.java Outdated
@t2gran
t2gran force-pushed the otp2_fix_npe_stop_tx_cost branch from 3e0c482 to b84f117 Compare July 3, 2024 09:45
@codecov

codecov Bot commented Jul 3, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 80.00000% with 6 lines in your changes missing coverage. Please review.

Project coverage is 69.45%. Comparing base (23f04a0) to head (0c914c4).
Report is 7 commits behind head on dev-2.x.

Files Patch % Lines
...raptoradapter/transit/mappers/TransfersMapper.java 0.00% 1 Missing and 1 partial ⚠️
...toradapter/transit/mappers/TransitLayerMapper.java 75.00% 1 Missing and 1 partial ⚠️
...entripplanner/transit/model/site/StopLocation.java 0.00% 1 Missing ⚠️
...pentripplanner/transit/service/StopModelIndex.java 88.88% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #5943      +/-   ##
=============================================
- Coverage      69.45%   69.45%   -0.01%     
- Complexity     17070    17071       +1     
=============================================
  Files           1937     1937              
  Lines          73692    73710      +18     
  Branches        7540     7544       +4     
=============================================
+ Hits           51184    51192       +8     
- Misses         19880    19885       +5     
- Partials        2628     2633       +5     

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

@vpaturet vpaturet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good. A few typos.

Comment thread src/main/java/org/opentripplanner/transit/service/StopModelIndex.java Outdated
Comment thread src/main/java/org/opentripplanner/transit/service/StopModelIndex.java Outdated
@t2gran
t2gran force-pushed the otp2_fix_npe_stop_tx_cost branch from d2517ad to 0c914c4 Compare July 3, 2024 12:06
@t2gran
t2gran merged commit 3d9cd5a into opentripplanner:dev-2.x Jul 4, 2024
t2gran pushed a commit that referenced this pull request Jul 4, 2024
t2gran pushed a commit that referenced this pull request Jul 4, 2024
t2gran added a commit to entur/OpenTripPlanner-LegacyHSLFork that referenced this pull request Jul 4, 2024
@t2gran
t2gran deleted the otp2_fix_npe_stop_tx_cost branch October 9, 2024 21:13
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. +Bump Serialization Id Add this label if you want the serialization id automatically bumped after merging the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants