Add validation on NeTEx flexible area import - #4765
Conversation
Codecov ReportBase: 61.85% // Head: 61.86% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #4765 +/- ##
==========================================
Coverage 61.85% 61.86%
- Complexity 12766 12770 +4
==========================================
Files 1614 1614
Lines 64468 64484 +16
Branches 7042 7044 +2
==========================================
+ Hits 39879 39891 +12
- Misses 22321 22325 +4
Partials 2268 2268
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
| static final Collection<Double> INVALID_AREA_POS_LIST = new ArrayList<>( | ||
| Arrays.asList( | ||
| 59.62575084033623, | ||
| 6.3023991052849, | ||
| 59.62883380609349, | ||
| 6.289718020117876, | ||
| 59.6346950024935, | ||
| 6.293494451572027 | ||
| ) | ||
| ); | ||
|
|
There was a problem hiding this comment.
| static final Collection<Double> INVALID_AREA_POS_LIST = new ArrayList<>( | |
| Arrays.asList( | |
| 59.62575084033623, | |
| 6.3023991052849, | |
| 59.62883380609349, | |
| 6.289718020117876, | |
| 59.6346950024935, | |
| 6.293494451572027 | |
| ) | |
| ); | |
| static final Collection<Double> INVALID_AREA_POS_LIST = List.of( | |
| 59.62575084033623, | |
| 6.3023991052849, | |
| 59.62883380609349, | |
| 6.289718020117876, | |
| 59.6346950024935, | |
| 6.293494451572027 | |
| ) | |
| ); | |
There was a problem hiding this comment.
true, and the original test data AREA_POS_LIST could also be simplified.
Done for both
leonardehrenfried
left a comment
There was a problem hiding this comment.
I have only a very minor comment.
| private Geometry mapGeometry(FlexibleArea area) { | ||
| try { | ||
| return OpenGisMapper.mapGeometry(area.getPolygon()); | ||
| } catch (Exception e) { |
There was a problem hiding this comment.
Should this be a more narrow type, which we even could include in the method contract?
jts seems to use IllegalArgumentException, so no
Summary
As mentioned in #4764, the graph builder crashes when importing invalid geometries in NeTEx FlexibleStopPlace.
This PR adds validation logic so that StopPlaces containing invalid geometries are ignored and invalid data is reported in the validation report.
Issue
Fixes #4764
Unit tests
Added unit tests
Documentation
No