0

I need to use JMapViewer to display an image in to map but when I update the map I obtain

Exception in thread "AWT-EventQueue-0" java.util.ConcurrentModificationException
    at java.util.LinkedList$ListItr.checkForComodification(Unknown Source)
    at java.util.LinkedList$ListItr.next(Unknown Source)
    at org.openstreetmap.gui.jmapviewer.JMapViewer.paintComponent(JMapViewer.java:617)
    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.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.prePaintDirtyRegions(Unknown Source)
    at javax.swing.RepaintManager.access$700(Unknown Source)
    at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source)
    at java.awt.event.InvocationEvent.dispatch(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.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)

I know what ConcurrentModificationException means but why in the exception there isn't the line of my program that throws this exception?Anyone can help me?

dofla
  • 3
  • 1
  • Any code you can show us? – matsjoyce Dec 06 '14 at 14:31
  • are you removing elements from the list in an enhanced for loop (`for(Something something : somethings) { somethings.remove(something); }`)? Because that throws this exception. – EpicPandaForce Dec 06 '14 at 14:33
  • technically the problem seems to be in `at org.openstreetmap.gui.jmapviewer.JMapViewer.paintComponent(JMapViewer.java:617)` can you debug that somehow if the sources are given? – EpicPandaForce Dec 06 '14 at 14:33
  • possible duplicate of [Iterating through a list, avoiding ConcurrentModificationException when removing in loop](http://stackoverflow.com/questions/223918/iterating-through-a-list-avoiding-concurrentmodificationexception-when-removing) – trashgod Dec 07 '14 at 05:38
  • trashgod, I don't think this post is duplicate of Iterating through a list, avoiding ConcurrentModificationException when removing in loop because this post is specific to JMapViewer and the other one is about removing items from a collection. By the way, I'm facing the same problem. As @EpicPandaForce asked, I'm using a loop to remove marks from the map. Is there a fix? – Alex8752 Apr 24 '18 at 20:04

0 Answers0