Skip to content

Conversation

@vpaturet
Copy link
Contributor

@vpaturet vpaturet commented Nov 12, 2025

Summary

When importing a NeTEx flex stop containing multiple areas, the graph builder crashes if one of the areas is invalid while the others are valid.

An uncaught error occurred inside OTP: java.lang.IllegalArgumentException: geometries must not contain null elements java.lang.RuntimeException: java.lang.IllegalArgumentException: geometries must not contain null elements
at org.opentripplanner.netex.NetexModule.buildGraph(NetexModule.java:123)
at org.opentripplanner.graph_builder.GraphBuilder.run(GraphBuilder.java:211)
at org.opentripplanner.standalone.OTPMain.startOTPServer(OTPMain.java:142)
at org.opentripplanner.standalone.OTPMain.main(OTPMain.java:55) Caused by: java.lang.IllegalArgumentException: geometries must not contain null elements
at org.locationtech.jts.geom.GeometryCollection.<init>(GeometryCollection.java:54)
at org.opentripplanner.transit.model.site.GroupStopBuilder.withEncompassingAreaGeometries(GroupStopBuilder.java:59)
at org.opentripplanner.netex.mapping.FlexStopsMapper.map(FlexStopsMapper.java:106)
at org.opentripplanner.netex.mapping.NetexMapper.mapFlexibleStopPlaces(NetexMapper.java:381)
at org.opentripplanner.netex.mapping.NetexMapper.mapNetexToOtp(NetexMapper.java:193)
at org.opentripplanner.netex.NetexBundle.loadFilesThenMapToTimetableRepository(NetexBundle.java:179)
at org.opentripplanner.netex.NetexBundle.lambda$loadFileEntries$1(NetexBundle.java:134)
at org.opentripplanner.netex.NetexBundle.scopeInputData(NetexBundle.java:155)
at org.opentripplanner.netex.NetexBundle.loadFileEntries(NetexBundle.java:132)
at org.opentripplanner.netex.NetexBundle.loadBundle(NetexBundle.java:106)
at org.opentripplanner.netex.NetexModule.buildGraph(NetexModule.java:75)

This PR fixes this corner-case.

Issue

No

Unit tests

Added unit test.
There was a latent bug in the unit tests where GroupStops were incorrectly cast to AreaStop. The bug was silent since the cast applied only to null references. This is fixed.

Documentation

No

Changelog

skip

@vpaturet vpaturet added !Bug Apply to issues describing a bug and PRs witch fixes it. Entur Test This is currently being tested at Entur +Skip Changelog This is not a relevant change for a product owner since last release. labels Nov 12, 2025
@vpaturet vpaturet marked this pull request as ready for review November 12, 2025 09:53
@vpaturet vpaturet requested a review from a team as a code owner November 12, 2025 09:53
@leonardehrenfried
Copy link
Member

Data producers will always find new ways to produce invalid data. :)

@codecov
Copy link

codecov bot commented Nov 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.22%. Comparing base (b7ed036) to head (13ef984).
⚠️ Report is 275 commits behind head on dev-2.x.

Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #7043      +/-   ##
=============================================
+ Coverage      72.11%   72.22%   +0.11%     
- Complexity     20058    20164     +106     
=============================================
  Files           2177     2188      +11     
  Lines          80926    81188     +262     
  Branches        8135     8142       +7     
=============================================
+ Hits           58359    58641     +282     
+ Misses         19697    19670      -27     
- Partials        2870     2877       +7     

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
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.

This looks fine, just a small update to doc

@leonardehrenfried
Copy link
Member

It appears that @t2gran has taken over my review so I let him also give the approval.

@t2gran t2gran added this to the 2.9 (next release) milestone Nov 19, 2025
@vpaturet vpaturet merged commit 44f5d4d into opentripplanner:dev-2.x Nov 19, 2025
8 checks passed
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. Entur Test This is currently being tested at Entur +Skip Changelog This is not a relevant change for a product owner since last release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants