Modify

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#7899 closed defect (fixed)

java.lang.ClassCastException when hitting the "w" button when drawing a line.

Reported by: rickmastfan67 Owned by: team
Priority: normal Milestone:
Component: Core Version: latest
Keywords: Cc:

Description

Just was normally editing tonight with the newest latest build and this error just popped up when I hit the "s" button while drawing a line.

Might be related to the [5358] fix, or I just somehow triggered something very rare.

Repository Root: http://josm.openstreetmap.de/svn
Build-Date: 2012-07-25 01:31:12
Last Changed Author: Don-vip
Revision: 5361
Repository UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
URL: http://josm.openstreetmap.de/svn/trunk
Last Changed Date: 2012-07-25 02:31:52 +0200 (Wed, 25 Jul 2012)
Last Changed Rev: 5361

Identification: JOSM/1.5 (5361 en)
Memory Usage: 122 MB / 2730 MB (41 MB allocated, but free)
Java version: 1.7.0_05, Oracle Corporation, Java HotSpot(TM) 64-Bit Server VM
Operating system: Windows 7
Dataset consistency test: No problems found

Plugin: OpeningHoursEditor (28477)
Plugin: buildings_tools (28412)
Plugin: mapdust (28412)
Plugin: measurement (28412)
Plugin: openstreetbugs (28412)
Plugin: reverter (28503)
Plugin: turnrestrictions (28412)
Plugin: undelete (28501)
Plugin: utilsplugin2 (28412)

java.lang.ClassCastException: org.openstreetmap.josm.tools.SubclassFilteredCollection cannot be cast to java.util.List
	at org.openstreetmap.josm.actions.mapmode.ImproveWayAccuracyAction.startImproving(ImproveWayAccuracyAction.java:589)
	at org.openstreetmap.josm.actions.mapmode.ImproveWayAccuracyAction.updateStateByCurrentSelection(ImproveWayAccuracyAction.java:629)
	at org.openstreetmap.josm.actions.mapmode.ImproveWayAccuracyAction.enterMode(ImproveWayAccuracyAction.java:139)
	at org.openstreetmap.josm.gui.MapFrame.selectMapMode(MapFrame.java:370)
	at org.openstreetmap.josm.gui.MapFrame.selectMapMode(MapFrame.java:349)
	at org.openstreetmap.josm.actions.mapmode.MapMode.actionPerformed(MapMode.java:74)
	at javax.swing.SwingUtilities.notifyAction(Unknown Source)
	at javax.swing.JComponent.processKeyBinding(Unknown Source)
	at javax.swing.KeyboardManager.fireBinding(Unknown Source)
	at javax.swing.KeyboardManager.fireKeyboardAction(Unknown Source)
	at javax.swing.JComponent.processKeyBindingsForAllComponents(Unknown Source)
	at javax.swing.JComponent.processKeyBindings(Unknown Source)
	at javax.swing.JComponent.processKeyEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
	at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
	at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
	at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
	at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.awt.EventQueue.access$000(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

Attachments (0)

Change History (9)

comment:1 by akks, 13 years ago

It seems you have pressed W, not S :)
I confirm the bug, it is very simple to reproduce - press W while drawing line by A (more than 1 segment).

comment:2 by Don-vip, 13 years ago

Certainly caused by my commit in r5360. Looks like ImproveWayAccuracyAction assumes DataSet.getSelection() returns a List instead of a Collection.

Last edited 13 years ago by Don-vip (previous) (diff)

comment:3 by Don-vip, 13 years ago

That's it: http://josm.openstreetmap.de/browser/josm/trunk/src/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyAction.java#L589

I do not have SVN access right now, can someone remove this cast, use Collection and iterator().next() instead of get(0) ?
We need also to check if other classes made this (bad) assumption.

comment:4 by rickmastfan67, 13 years ago

Summary: java.lang.ClassCastException when hitting the "s" button when drawing a line.java.lang.ClassCastException when hitting the "w" button when drawing a line.

Fixed the subject. ;)

comment:5 by akks, 13 years ago

I have searched through the core and found no more bad assumptions (no more unchecked conversions to types *List*<*> or List of selections).
Not so sure about plugins...

comment:6 by akks, 13 years ago

Resolution: fixed
Status: newclosed

In 5364/josm:

fix #7899 by Don-vip: exception hen hitting the "w" button when drawing a line.

comment:7 by akks, 13 years ago

Please check the change and reopen if similar problem persists.

comment:8 by Don-vip, 13 years ago

Looks fine :) Thank you !

comment:9 by Don-vip, 13 years ago

Ticket #7901 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. 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.