Modify ↓
Opened 6 years ago
Closed 6 years ago
#17680 closed defect (fixed)
Suspicious code in Geometry.addIntersections()
Reported by: | GerdP | Owned by: | team |
---|---|---|---|
Priority: | minor | Milestone: | 19.05 |
Component: | Core | Version: | |
Keywords: | javadoc | Cc: |
Description
The javadoc says
/** * Will find all intersection and add nodes there for list of given ways. * Handles self-intersections too. * And makes commands to add the intersection points to ways. * * Prerequisite: no two nodes have the same coordinates. * * @param ways a list of ways to test * @param test if false, do not build list of Commands, just return nodes * @param cmds list of commands, typically empty when handed to this method. * Will be filled with commands that add intersection nodes to * the ways. * @return list of new nodes */
I tried to use this method with a list of multipolygon ways like this
Set<Node> selfIntersections = Geometry.addIntersections(ways, false, null);
I got a NPE because in line 218 there is no check if test is set or not:
if (intNode == newNode) { cmds.add(new AddCommand(dataset, intNode)); }
I wonder if JoinAreasAction needs this or if it sometimes fails because of this. It uses the method like this:
Set<Node> nodes = Geometry.addIntersections(allStartingWays, false, cmds);
Attachments (1)
Change History (5)
by , 6 years ago
Attachment: | 17680.patch added |
---|
comment:1 by , 6 years ago
Milestone: | → 19.05 |
---|
comment:3 by , 6 years ago
Keywords: | javadoc added |
---|---|
Priority: | normal → minor |
Note:
See TracTickets
for help on using tickets.
Seems that only the javadoc is wrong. The attached patch fixes this.
If I hear no complains I'll commit this tomorrow.