Modify

Opened 8 years ago

Closed 8 years ago

Last modified 6 years ago

#6592 closed defect (fixed)

[Patch] IllegalArgumentException when viewing history of incomplete relation members

Reported by: Don-vip Owned by: team
Priority: normal Milestone:
Component: Core Version:
Keywords: template_report Cc:

Description

What steps will reproduce the problem?

  1. Select members of an incomplete relation
  2. Click on "Show" button of History view

What is the expected result? Don't know. Is it relevant to enable history of a member not downloaded ?

What happens instead? An ugly error popup window ;)

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

Repository Root: http://josm.openstreetmap.de/svn
Build-Date: 2011-07-13 01:31:30
Last Changed Author: jttt
Revision: 4229
Repository UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
URL: http://josm.openstreetmap.de/svn/trunk
Last Changed Date: 2011-07-12 20:47:58 +0200 (Tue, 12 Jul 2011)
Last Changed Rev: 4229

Identification: JOSM/1.5 (4229 fr)
Memory Usage: 201 MB / 3729 MB (48 MB allocated, but free)
Java version: 1.6.0_26, Sun Microsystems Inc., Java HotSpot(TM) 64-Bit Server VM
Operating system: Windows 7
Dataset consistency test: No problems found

Plugin: OpeningHoursEditor (26284)
Plugin: RoadSigns (26174)
Plugin: cadastre-fr (26284)
Plugin: epci-fr (26282)
Plugin: openstreetbugs (26299)
Plugin: photo_geotagging (26174)
Plugin: proj4j (26174)
Plugin: public_transport (26284)
Plugin: restart (26254)

java.lang.IllegalArgumentException: Parameter 'version' > 0 expected. Got '0'.
	at org.openstreetmap.josm.data.osm.history.HistoryOsmPrimitive.ensurePositiveLong(HistoryOsmPrimitive.java:36)
	at org.openstreetmap.josm.data.osm.history.HistoryOsmPrimitive.<init>(HistoryOsmPrimitive.java:54)
	at org.openstreetmap.josm.data.osm.history.HistoryNode.<init>(HistoryNode.java:20)
	at org.openstreetmap.josm.gui.history.HistoryBrowserModel$HistoryPrimitiveBuilder.visit(HistoryBrowserModel.java:880)
	at org.openstreetmap.josm.data.osm.Node.visit(Node.java:185)
	at org.openstreetmap.josm.gui.history.HistoryBrowserModel$HistoryPrimitiveBuilder.build(HistoryBrowserModel.java:902)
	at org.openstreetmap.josm.gui.history.HistoryBrowserModel.setHistory(HistoryBrowserModel.java:175)
	at org.openstreetmap.josm.gui.history.HistoryBrowser.populate(HistoryBrowser.java:127)
	at org.openstreetmap.josm.gui.history.HistoryBrowserDialog.setHistory(HistoryBrowserDialog.java:107)
	at org.openstreetmap.josm.gui.history.HistoryBrowserDialog.<init>(HistoryBrowserDialog.java:96)
	at org.openstreetmap.josm.gui.history.HistoryBrowserDialogManager.show(HistoryBrowserDialogManager.java:107)
	at org.openstreetmap.josm.gui.dialogs.HistoryDialog$ShowHistoryAction$1.run(HistoryDialog.java:365)
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

Attachments (1)

6592.patch (6.8 KB) - added by simon04 8 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 8 years ago by Don-vip

I have the same error if I try to look at the history of an element obtained from the Overpass API, and not updated after.
I think the "view history" should be disabled in that case.

comment:2 Changed 8 years ago by rickmastfan67

I can confirm this is still happening in r4279.

Repository Root: http://josm.openstreetmap.de/svn
Build-Date: 2011-08-01 01:31:34
Last Changed Author: stoecker
Revision: 4279
Repository UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
URL: http://josm.openstreetmap.de/svn/trunk
Last Changed Date: 2011-07-31 23:52:49 +0200 (Sun, 31 Jul 2011)
Last Changed Rev: 4279

Identification: JOSM/1.5 (4279 en)
Memory Usage: 204 MB / 3640 MB (81 MB allocated, but free)
Java version: 1.6.0_26, Sun Microsystems Inc., Java HotSpot(TM) 64-Bit Server VM
Operating system: Windows 7
Dataset consistency test: No problems found

Plugin: OpeningHoursEditor (26284)
Plugin: buildings_tools (26254)
Plugin: imageryadjust (26174)
Plugin: licensechange (26377)
Plugin: mapdust (26174)
Plugin: measurement (26174)
Plugin: michigan_left (26174)
Plugin: openstreetbugs (26299)
Plugin: restart (26254)
Plugin: reverter (26254)
Plugin: turnlanes (26316)
Plugin: turnrestrictions (26299)
Plugin: undelete (26254)
Plugin: utilsplugin2 (26395)

java.lang.IllegalArgumentException: Parameter 'version' > 0 expected. Got '0'.
	at org.openstreetmap.josm.data.osm.history.HistoryOsmPrimitive.ensurePositiveLong(HistoryOsmPrimitive.java:36)
	at org.openstreetmap.josm.data.osm.history.HistoryOsmPrimitive.<init>(HistoryOsmPrimitive.java:54)
	at org.openstreetmap.josm.data.osm.history.HistoryWay.<init>(HistoryWay.java:22)
	at org.openstreetmap.josm.gui.history.HistoryBrowserModel$HistoryPrimitiveBuilder.visit(HistoryBrowserModel.java:894)
	at org.openstreetmap.josm.data.osm.Way.visit(Way.java:161)
	at org.openstreetmap.josm.gui.history.HistoryBrowserModel$HistoryPrimitiveBuilder.build(HistoryBrowserModel.java:902)
	at org.openstreetmap.josm.gui.history.HistoryBrowserModel.setHistory(HistoryBrowserModel.java:175)
	at org.openstreetmap.josm.gui.history.HistoryBrowser.populate(HistoryBrowser.java:127)
	at org.openstreetmap.josm.gui.history.HistoryBrowserDialog.setHistory(HistoryBrowserDialog.java:107)
	at org.openstreetmap.josm.gui.history.HistoryBrowserDialog.<init>(HistoryBrowserDialog.java:96)
	at org.openstreetmap.josm.gui.history.HistoryBrowserDialogManager.show(HistoryBrowserDialogManager.java:107)
	at org.openstreetmap.josm.gui.dialogs.HistoryDialog$ShowHistoryAction$1.run(HistoryDialog.java:365)
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

Changed 8 years ago by simon04

Attachment: 6592.patch added

comment:3 Changed 8 years ago by simon04

Summary: IllegalArgumentException when viewing history of incomplete relation members[Patch] IllegalArgumentException when viewing history of incomplete relation members

Patch attached. Allows showing the history for incomplete members or with missing version (e.g. data from OverpassAPI). :-)

Please test and report with example OSM file.

comment:4 Changed 8 years ago by stoecker

Resolution: fixed
Status: newclosed

In [4339/josm]:

fix #6592 - patch by simon04 - Exception showing history of incomplete objects

comment:5 Changed 8 years ago by stoecker

In the rare cases where we have set/get (setCoor() in this case) please don't dis-use them :-)

comment:6 in reply to:  5 Changed 8 years ago by simon04

Replying to stoecker:

In the rare cases where we have set/get (setCoor() in this case) please don't dis-use them :-)

I found it unusual to use setters in constructors. For instance, the automatically generated constructors by Netbeans are of the shape this.x = x;. I found this on Stack Overflow: http://stackoverflow.com/questions/4893558/calling-setters-from-a-constructor

comment:7 Changed 8 years ago by stoecker

JOSM does not follow the Java suggestion to use setters/getters for all variables. So when we have setters/getters this usually means we want an additional abstraction level. Using both setters/getters and direct assignment is dangerous in cases where this additional abstraction is used later to change the way these functions are implemented. In these cases the direct assignments are easily overlooked.

So while the stuff in your link is valid, for me usually the most important part is to not use two mechanisms in parallel. The general advice: Don't do things which other programmers do not expect :-)

comment:8 Changed 6 years ago by Don-vip

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

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.

Add Comment


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

 
Note: See TracTickets for help on using tickets.