Modify

Opened 2 years ago

Closed 6 weeks ago

#14650 closed defect (fixed)

[PATCH] IAE: Invalid number of points in LinearRing

Reported by: bagage Owned by: Don-vip
Priority: normal Milestone:
Component: Plugin jts Version: latest
Keywords: template_report Cc:

Description

What steps will reproduce the problem?

  1. Open the bug.osm attached file. Select the way as reference layer
  2. Use anything as subject layer
  3. Hit "Generate matches"

What is the expected result?

Matches are generated.

What happens instead?

Exception is thrown "java.lang.IllegalArgumentException: Invalid number of points in LinearRing (found 3 - must be 0 or >= 4)".

Please provide any additional information below. Attach a screenshot if possible.

Build-Date:2017-04-10 14:26:00
Revision:11883
Is-Local-Build:true

Identification: JOSM/1.5 (11883 SVN en) Linux Debian GNU/Linux 9.0 (stretch)
Memory Usage: 823 MB / 1760 MB (142 MB allocated, but free)
Java version: 1.8.0_121-8u121-b13-4-b13, Oracle Corporation, OpenJDK 64-Bit Server VM
Screen: :0.0 1920x1080
Maximum Screen Size: 1920x1080
Java package: openjdk-8-jre:amd64-8u121-b13-4
Java ATK Wrapper package: libatk-wrapper-java:all-0.33.3-13
Program arguments: [--language=en, ${HOME}/majcadastre/CL325-SAINT-RAMBERT-D ALBON/CL325-SAINT-RAMBERT-D ALBON-houses-simplifie.osm]
Dataset consistency test: No problems found

Plugins:
+ PicLayer (33148)
+ buildings_tools (33004)
+ conflation (0.5.3)
+ jts (32699)
+ rex (26)
+ todo (30000)
+ utilsplugin2 (33212)

Last errors/warnings:
- W: Old style SideButton usage for action org.openstreetmap.josm.plugins.todo.TodoDialog$MarkAction@4d2adbc0
- W: Old style SideButton usage for action org.openstreetmap.josm.plugins.todo.TodoDialog$MarkSelectedAction@383a536
- E: Handled by bug report queue: java.lang.IllegalArgumentException: Invalid number of points in LinearRing (found 3 - must be 0 or >= 4)
- E: Handled by bug report queue: java.lang.IllegalArgumentException: Invalid number of points in LinearRing (found 3 - must be 0 or >= 4)
- E: Handled by bug report queue: java.lang.IllegalArgumentException: Invalid number of points in LinearRing (found 3 - must be 0 or >= 4)
- E: Handled by bug report queue: java.lang.IllegalArgumentException: Invalid number of points in LinearRing (found 3 - must be 0 or >= 4)
- E: Handled by bug report queue: java.lang.IllegalArgumentException: Invalid number of points in LinearRing (found 3 - must be 0 or >= 4)
- E: Handled by bug report queue: java.lang.IllegalArgumentException: Invalid number of points in LinearRing (found 3 - must be 0 or >= 4)
- E: Handled by bug report queue: java.lang.IllegalArgumentException: Invalid number of points in LinearRing (found 3 - must be 0 or >= 4)
- E: Handled by bug report queue: java.lang.IllegalArgumentException: Invalid number of points in LinearRing (found 3 - must be 0 or >= 4)


=== REPORTED CRASH DATA ===
BugReportExceptionHandler#handleException:
No data collected.

Warning issued by: BugReportExceptionHandler#handleException

=== STACK TRACE ===
Thread: AWT-EventQueue-0 (17) of main
java.lang.IllegalArgumentException: Invalid number of points in LinearRing (found 3 - must be 0 or >= 4)
	at com.vividsolutions.jts.geom.LinearRing.validateConstruction(LinearRing.java:114)
	at com.vividsolutions.jts.geom.LinearRing.<init>(LinearRing.java:106)
	at org.openstreetmap.josm.plugins.jts.JTSConverter.convertWay(JTSConverter.java:93)
	at org.openstreetmap.josm.plugins.jts.JTSConverter.convert(JTSConverter.java:104)
	at org.openstreetmap.josm.plugins.conflation.OsmFeature.<init>(OsmFeature.java:35)
	at org.openstreetmap.josm.plugins.conflation.MatchesComputation.createFeatureCollection(MatchesComputation.java:119)
	at org.openstreetmap.josm.plugins.conflation.MatchesComputation.generateMatches(MatchesComputation.java:48)
	at org.openstreetmap.josm.plugins.conflation.ConflationToggleDialog$2.realRun(ConflationToggleDialog.java:1142)
	at org.openstreetmap.josm.gui.PleaseWaitRunnable.doRealRun(PleaseWaitRunnable.java:95)
	at org.openstreetmap.josm.gui.PleaseWaitRunnable.run(PleaseWaitRunnable.java:143)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

Attachments (2)

bug.osm (564 bytes) - added by bagage 2 years ago.
the bogus item that raises the exception
Avoid_IAE_when_converting_3-nodes_way_to_LinearRing.patch (822 bytes) - added by bagage 7 months ago.
patch

Download all attachments as: .zip

Change History (10)

Changed 2 years ago by bagage

Attachment: bug.osm added

the bogus item that raises the exception

comment:1 Changed 2 years ago by Don-vip

Summary: Crash when conflating simple wayIAE: Invalid number of points in LinearRing

comment:2 Changed 7 months ago by bagage

Summary: IAE: Invalid number of points in LinearRing[PATCH] IAE: Invalid number of points in LinearRing

I've added a patch to stop the IAE - and in my case for conflation it works great (eg as expected).

comment:3 Changed 7 months ago by GerdP

I'd rather say that a way with only 2 distinct nodes is not closed. Or maybe the check should be changed to Way.isArea()
which seems to catch also duplicated notes.

comment:4 Changed 7 months ago by bagage

I'm not sure I can argue much here about the better approach. Indeed 2-nodes way should not be considered closed IMO but I do not know side effects it may have. I believe you are in a better position to know the best fix here :-).

comment:5 Changed 2 months ago by bagage

Hi, could someone guide me around this?

Should I adapt my patch to follow GerdP advices or is it OK as it?

Thanks!

comment:6 Changed 6 weeks ago by Don-vip

Ticket #17913 has been marked as a duplicate of this ticket.

comment:7 Changed 6 weeks ago by Don-vip

Component: Plugin conflationPlugin jts
Owner: changed from Tyndare to Don-vip
Status: newassigned

comment:8 in reply to:  5 Changed 6 weeks ago by Don-vip

Resolution: fixed
Status: assignedclosed

Replying to bagage:

Should I adapt my patch to follow GerdP advices or is it OK as it?

Sounds scary. I have applied a modified version of the simple patch in [o35064] and released the plugin in [o35065].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Don-vip.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.