Modify

Opened 10 years ago

Closed 10 years ago

#2545 closed defect (fixed)

JOSM has problems with files from XAPI

Reported by: PetrDlouhy Owned by: framm
Priority: major Milestone:
Component: Core Version:
Keywords: Cc: Gubaer

Description

When I download something from XAPI, for example http://osmxapi.hypercube.telascience.org/api/0.6/relation[route=bicycle[bbox=12.06,48.57,18.97,51.06] bicycle routes], change sometnig, and I want to send my changes to server, it doesn't work. JOSM either pops up error some error in data upload or ends up in following unhandled exception:

Path: trunk
URL: http://josm.openstreetmap.de/svn/trunk
Repository Root: http://josm.openstreetmap.de/svn
Repository UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Revision: 1580
Node Kind: directory
Last Changed Author: ce
Last Changed Rev: 1580
Last Changed Date: 2009-05-06 19:49:44 +0200 (Wed, 06 May 2009)

Java version: 1.6.0_13
Plugins: AgPifoJ;measurement;routes;routing;validator;wmsplugin
Plugin AgPifoJ Version: 14290
Plugin measurement Version: 14015
Plugin routes
Plugin routing Version: 14404
Plugin validator Version: 14123
Plugin wmsplugin Version: 14120

java.lang.RuntimeException: java.lang.NullPointerException

at org.openstreetmap.josm.gui.PleaseWaitRunnable$4.run(PleaseWaitRunnable.java:119)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Caused by: java.lang.NullPointerException

at org.openstreetmap.josm.io.XmlWriter.encode(XmlWriter.java:26)
at org.openstreetmap.josm.io.OsmWriter.visit(OsmWriter.java:129)
at org.openstreetmap.josm.data.osm.visitor.CreateOsmChangeVisitor.visit(CreateOsmChangeVisitor.java:78)
at org.openstreetmap.josm.data.osm.Relation.visit(Relation.java:31)
at org.openstreetmap.josm.io.OsmApi.uploadDiff(OsmApi.java:307)
at org.openstreetmap.josm.io.OsmServerWriter.uploadOsm(OsmServerWriter.java:100)
at org.openstreetmap.josm.actions.UploadAction$2.realRun(UploadAction.java:183)
at org.openstreetmap.josm.gui.PleaseWaitRunnable.run(PleaseWaitRunnable.java:101)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)

Attachments (3)

relation-reading.patch (5.4 KB) - added by Gubaer 10 years ago.
relation-reading-1.patch (5.6 KB) - added by Gubaer 10 years ago.
relation-reading-2.patch (6.0 KB) - added by Gubaer 10 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 10 years ago by anonymous

The other error is:
Cannot parse valid node from xml string ... Version is required when updating

Changed 10 years ago by Gubaer

Attachment: relation-reading.patch added

comment:2 Changed 10 years ago by Gubaer

Cc: Gubaer added
Summary: JOSM have problems with files from XAPI[Patch] JOSM have problems with files from XAPI

There is a problem with the output from OSMXAPI. It seems that it doesn't include a version number on all elements and without a version number JOSM can't upload modified data. Whether and when OSMXAPI supports API 0.6 seems to be an open issue.

JOSM should have aborted the loading of http://osmxapi.hypercube.telascience.org/api/0.6/relation[route=bicycle][bbox=12.06,48.57,18.97,51.06] with an error message but it didn't check for data consistency so far.

The attached patch should change this.

It also removes some code related to an attribute "oldversion". I could't find any reference to "oldversion" in the API 0.6 spec and so far I never saw it OSM files.

Changed 10 years ago by Gubaer

Attachment: relation-reading-1.patch added

comment:3 Changed 10 years ago by Gubaer

attachment:relation-reading-1.patch is an update of the patch. It accepts OSM primitives with id < 0 and a missing version attribute.

comment:4 Changed 10 years ago by stoecker

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

comment:5 Changed 10 years ago by framm

This patch breaks readability of version 0.5 files. I think it should still be allowed to open 0.5 files in JOSM, and an error should only occur when it is attempted to upload them to a 0.6 server.

Changed 10 years ago by Gubaer

Attachment: relation-reading-2.patch added

comment:6 Changed 10 years ago by Gubaer

I give it another try, see attachment:relation-reading-2.patch

  • now allows for missing version attribute in 0.5 files
  • now also reads new uid attribute introduced in 0.6
  • now avoids NPE because of undefined role on a relation member if user tries to write a dataset

BTW: how do you test that readability of a 0.5 file? Do you have any canonical 0.5 test files? There's no live API 0.5 around anymore to generate 0.5 files, is there?

comment:7 Changed 10 years ago by Gubaer

Owner: changed from team to framm

comment:8 Changed 10 years ago by stoecker

Resolution: fixed
Status: newclosed
Summary: [Patch] JOSM have problems with files from XAPIJOSM has problems with files from XAPI

In r1604.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain framm.
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.