Modify

Opened 4 years ago

Closed 4 years ago

#2545 closed defect (fixed)

JOSM has problems with files from XAPI

Reported by: Petr Dlouhý Owned by: framm
Priority: major Component: Core
Version: Keywords:
Cc: karl.guggisberg@…

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 4 years ago.
relation-reading-1.patch (5.6 KB) - added by Gubaer 4 years ago.
relation-reading-2.patch (6.0 KB) - added by Gubaer 4 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 4 years ago by anonymous

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

Changed 4 years ago by Gubaer

comment:2 Changed 4 years ago by Gubaer

  • Cc karl.guggisberg@… added
  • Summary changed from JOSM have problems with files from XAPI to [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 4 years ago by Gubaer

comment:3 Changed 4 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 4 years ago by stoecker

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

comment:5 Changed 4 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 4 years ago by Gubaer

comment:6 Changed 4 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 4 years ago by Gubaer

  • Owner changed from team to framm

comment:8 Changed 4 years ago by stoecker

  • Resolution set to fixed
  • Status changed from new to closed
  • Summary changed from [Patch] JOSM have problems with files from XAPI to JOSM has problems with files from XAPI

In r1604.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed .
as The resolution will be set. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.