Modify

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#17578 closed defect (fixed)

OSM XML with ways that have "visible"="false" causes an IllegalStateException

Reported by: Atakua Owned by: team
Priority: normal Milestone: 19.04
Component: Core Version:
Keywords: Cc: ggg_mail@…

Description

I was playing with generating OSM files in third-party tools and loading them into JOSM. In an attempt to hide some ways I assigned their "visible" attribute to "false".

The following stack trace was shown to me on an attempt to load such file into JOSM. On top of the call stack, it says "A primitive with ID = 0 cannot be invisible". An expected behavior would be not to raise an exception but show a modal error window explaining to a user that the file was badly formatted.

URL:https://josm.openstreetmap.de/svn/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2019-03-31 21:17:00 +0200 (Sun, 31 Mar 2019)
Build-Date:2019-03-31 20:25:18
Revision:14945
Relative:URL: ^/trunk

Identification: JOSM/1.5 (14945 sv) Linux Debian GNU/Linux 9.8 (stretch)
Memory Usage: 1598 MB / 1820 MB (450 MB allocated, but free)
Java version: 1.8.0_212-8u212-b01-1~deb9u1-b01, Oracle Corporation, OpenJDK 64-Bit Server VM
Screen: :0.0 1920x1200
Maximum Screen Size: 1920x1200
Java package: openjdk-8-jre:amd64-8u212-b01-1~deb9u1
WebStart package: icedtea-netx:amd64-1.6.2-3.1
Java ATK Wrapper package: libatk-wrapper-java:all-0.33.3-13+deb9u1
VM arguments: [-Dicedtea-web.bin.name=javaws, -Dicedtea-web.bin.location=/usr/bin/javaws, -Djava.security.manager, -Djava.security.policy=/etc/icedtea-web/javaws.policy]
Dataset consistency test: No problems found

Plugins:
+ DirectDownload (34867)
+ DirectUpload (34867)
+ FastDraw (34949)
+ SimplifyArea (34867)
+ apache-commons (34506)
+ buildings_tools (34904)
+ conflation (0.6.2)
+ contourmerge (v0.1.4)
+ editgpx (34867)
+ ejml (34389)
+ ext_tools (34867)
+ geojson (116)
+ geotools (34513)
+ imagery_offset_db (34867)
+ jaxb (34678)
+ jts (34524)
+ merge-overlap (34664)
+ opendata (34911)
+ osmarender (34678)
+ reltoolbox (34867)
+ reverter (34953)
+ turnrestrictions (34867)
+ utilsplugin2 (34932)

Last errors/warnings:
- W: Already here java.net.SocketTimeoutException: Read timed out
- E: java.net.SocketTimeoutException: connect timed out
- W: org.openstreetmap.josm.io.OsmTransferException: Kunde inte ansluta till osm-servern. Kontrollera din internetanslutning.. Anledning: java.net.SocketTimeoutException: connect timed out
- E: org.openstreetmap.josm.io.IllegalDataException: Rad 1 kolumn 1: Innehållet är inte tillåtet i prologen.. Anledning: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
- E: Fel - <html>Kunde inte läsa filen 'test-new-bb.osm'.<br>Felet är:<br>Rad 1 kolumn 1: Innehållet är inte tillåtet i prologen.</html>
- E: org.openstreetmap.josm.io.IllegalDataException: Missing required attribute 'id'. (på rad 38, kolumn 160). 2 064 bytes have been read. Anledning: org.openstreetmap.josm.io.XmlStreamParsingException: Missing required attribute 'id'. (på rad 38, kolumn 160). 2 064 bytes have been read. Anledning: org.openstreetmap.josm.io.IllegalDataException: Missing required attribute 'id'.
- E: Fel - <html>Kunde inte läsa filen 'test-new-bbs.osm'.<br>Felet är:<br>Missing required attribute 'id'. (på rad 38, kolumn 160). 2 064 bytes have been read</html>
- E: org.openstreetmap.josm.io.IllegalDataException: Missing required attribute 'id'. (på rad 40, kolumn 82). 2 061 bytes have been read. Anledning: org.openstreetmap.josm.io.XmlStreamParsingException: Missing required attribute 'id'. (på rad 40, kolumn 82). 2 061 bytes have been read. Anledning: org.openstreetmap.josm.io.IllegalDataException: Missing required attribute 'id'.
- E: Fel - <html>Kunde inte läsa filen 'test-new-bbs-filt.osm'.<br>Felet är:<br>Missing required attribute 'id'. (på rad 40, kolumn 82). 2 061 bytes have been read</html>
- E: Handled by bug report queue: java.lang.IllegalStateException: En primitiv med ID = 0 kan Ej vara osynlig.


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

Warning issued by: BugReportExceptionHandler#handleException

=== STACK TRACE ===
Thread: main-worker-0 (124) of JOSM
java.lang.IllegalStateException: En primitiv med ID = 0 kan Ej vara osynlig.
	at org.openstreetmap.josm.data.osm.AbstractPrimitive.setVisible(AbstractPrimitive.java:390)
	at org.openstreetmap.josm.io.AbstractReader.parseVisible(AbstractReader.java:446)
	at org.openstreetmap.josm.io.OsmReader.readCommon(OsmReader.java:392)
	at org.openstreetmap.josm.io.AbstractReader.parseWay(AbstractReader.java:675)
	at org.openstreetmap.josm.io.OsmReader.parseWay(OsmReader.java:208)
	at org.openstreetmap.josm.io.OsmReader.parseOsm(OsmReader.java:122)
	at org.openstreetmap.josm.io.OsmReader.parseRoot(OsmReader.java:85)
	at org.openstreetmap.josm.io.OsmReader.parse(OsmReader.java:71)
	at org.openstreetmap.josm.io.OsmReader.lambda$doParseDataSet$0(OsmReader.java:430)
	at org.openstreetmap.josm.io.AbstractReader.doParseDataSet(AbstractReader.java:297)
	at org.openstreetmap.josm.io.OsmReader.doParseDataSet(OsmReader.java:427)
	at org.openstreetmap.josm.io.OsmReader.parseDataSet(OsmReader.java:460)
	at org.openstreetmap.josm.gui.io.importexport.OsmImporter.parseDataSet(OsmImporter.java:130)
	at org.openstreetmap.josm.gui.io.importexport.OsmImporter.loadLayer(OsmImporter.java:120)
	at org.openstreetmap.josm.gui.io.importexport.OsmImporter.importData(OsmImporter.java:97)
	at org.openstreetmap.josm.gui.io.importexport.OsmImporter.importData(OsmImporter.java:82)
	at org.openstreetmap.josm.gui.io.importexport.FileImporter.importDataHandleExceptions(FileImporter.java:95)
	at org.openstreetmap.josm.actions.OpenFileAction$OpenFileTask.importData(OpenFileAction.java:367)
	at org.openstreetmap.josm.actions.OpenFileAction$OpenFileTask.realRun(OpenFileAction.java:319)
	at org.openstreetmap.josm.gui.PleaseWaitRunnable.doRealRun(PleaseWaitRunnable.java:94)
	at org.openstreetmap.josm.gui.PleaseWaitRunnable.run(PleaseWaitRunnable.java:142)
	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:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

Here is an example of an OSM file to reproduce the issue:

<osm generator="JOSM" version="0.6">
  <node action="modify" id="-5328343" lat="59.43848585973" lon="18.16816802502" visible="true" />
  <node action="modify" id="-5328344" lat="59.43852950144" lon="18.17142959118" visible="true" />
  <node action="modify" id="-5328346" lat="59.43698018616" lon="18.17138667583" visible="true" />
  <node action="modify" id="-5328348" lat="59.43698018616" lon="18.16829677105" visible="true" />
  <node action="modify" id="-5328354" lat="59.44293702448" lon="18.16537852764" visible="true" />
  <node action="modify" id="-5328356" lat="59.44298066045" lon="18.17095752239" visible="true" />
  <node action="modify" id="-5328358" lat="59.44140973002" lon="18.16988463879" visible="true" />
  <node action="modify" id="-5328360" lat="59.43922776119" lon="18.15606589794" visible="true" />
  <node action="modify" id="-5328366" lat="59.43375039945" lon="18.15576549053" visible="true" />
  <node action="modify" id="-5328368" lat="59.43457969843" lon="18.16215987682" visible="true" />
  <node action="modify" id="-5328370" lat="59.43169888835" lon="18.16130156994" visible="true" />
  <node action="modify" id="-5328372" lat="59.43193896523" lon="18.15739627361" visible="true" />
  <way action="modify" id="-5328345" visible="false">
    <nd ref="-5328343" />
    <nd ref="-5328344" />
    <nd ref="-5328346" />
    <nd ref="-5328348" />
    <nd ref="-5328343" />
    <tag k="landuse" v="industrial" />
  </way>
</osm>

Attachments (1)

test-new-bbs.osm (1.4 KB ) - added by Atakua 6 years ago.
A reproducer OSM file

Download all attachments as: .zip

Change History (7)

by Atakua, 6 years ago

Attachment: test-new-bbs.osm added

A reproducer OSM file

comment:1 by GerdP, 6 years ago

My understanding is that you cannot have "modifiy" in combination with negative ids. It must be "create" instead.
On the other hand, visible=false is normally used to mark an existing object as deleted. Again, this cannot be done with negative ids.

comment:2 by Atakua, 6 years ago

Hi! I am not objecting that my file is incorrect. This bug is about making its corresponding error message more user-friendly. When I made other mistakes in my OSM XML files, an error was shown as a modal window with a description. It was perceived by me as user/external tools problem. On the other side, "visible=false" type of input causes an "internal error" window, hinting it is JOSM's internal bug. Which it is not, it is still an external file malformed state.

comment:3 by GerdP, 6 years ago

Ah, okay. I did not understand that you did not see a normal error popup.

comment:4 by GerdP, 6 years ago

Resolution: fixed
Status: newclosed

In 14983/josm:

fix #17578: catch IllegalStateException

comment:5 by Klumbumbus, 6 years ago

Milestone: 19.04

comment:6 by Klumbumbus, 6 years ago

Component: unspecifiedCore
Priority: minornormal

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.