[OSM-dev] ConcurrentModificationException in Josm every few minutes - and possible fix

Marcus Wolschon Marcus at wolschon.biz
Wed Dec 17 19:53:18 GMT 2008


When I use JOSM with liveGPS+Surveyor I get the following StackTrace every
few minutes.
This would not be too bad IF an Exception would not mean
a) a popup making surveyor lose the keybord-focus and
b) LiveGPS losing the connection to the GPS-unit
...every 5 minutes. It gets worse the more gpx-points are
already collected.

I guess it was not anticipated that gpx-layers may be modified while
they are drawn.
Could someone with CVS-write-access please add the following line into
line 113 in
GpxLayer.java:

ArrayList tempWayPoints = new ArrayList(trk.trackSegs) // copy List to
avoid concurrent modification
for (WayPoint tpt : tempWayPoints) {



here is the Stack-trace.

java.util.ConcurrentModificationException
	at java.util.AbstractList$Itr.checkForComodification(Unknown Source)
	at java.util.AbstractList$Itr.next(Unknown Source)
	at org.openstreetmap.josm.data.gpx.GpxData.length(GpxData.java:113)
	at
org.openstreetmap.josm.gui.layer.GpxLayer.getToolTipText(GpxLayer.java:317)
	at
org.openstreetmap.josm.gui.dialogs.LayerListDialog$1.getListCellRendererComponent(LayerListDialog.java:176)
	at javax.swing.plaf.basic.BasicListUI.paintCell(Unknown Source)
	at javax.swing.plaf.basic.BasicListUI.paintImpl(Unknown Source)
	at javax.swing.plaf.basic.BasicListUI.paint(Unknown Source)
	at javax.swing.plaf.ComponentUI.update(Unknown Source)
	at javax.swing.JComponent.paintComponent(Unknown Source)
	at javax.swing.JComponent.paint(Unknown Source)
	at javax.swing.JComponent.paintChildren(Unknown Source)
	at javax.swing.JComponent.paint(Unknown Source)
	at javax.swing.JViewport.paint(Unknown Source)
	at javax.swing.JComponent.paintChildren(Unknown Source)
	at javax.swing.JComponent.paint(Unknown Source)
	at javax.swing.JComponent.paintChildren(Unknown Source)
	at javax.swing.JComponent.paint(Unknown Source)
	at javax.swing.JComponent.paintChildren(Unknown Source)
	at javax.swing.JComponent.paint(Unknown Source)
	at javax.swing.JComponent.paintChildren(Unknown Source)
	at javax.swing.JComponent.paint(Unknown Source)
	at javax.swing.JComponent.paintToOffscreen(Unknown Source)
	at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown
Source)
	at javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
	at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
	at javax.swing.RepaintManager.paint(Unknown Source)
	at javax.swing.JComponent._paintImmediately(Unknown Source)
	at javax.swing.JComponent.paintImmediately(Unknown Source)
	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
	at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
	at
javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown
Source)
	at java.awt.event.InvocationEvent.dispatch(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)




More information about the dev mailing list