#19055 closed defect (fixed)
IndexOutOfBoundsException: relation manager: refreshing data with discarding changes
Reported by: | skyper | Owned by: | GerdP |
---|---|---|---|
Priority: | normal | Milestone: | 20.11 |
Component: | Core | Version: | latest |
Keywords: | template_report relation editor refresh undo regression | Cc: | simon04 |
Description
What steps will reproduce the problem?
- Open 18018:josm_18018_example_v4.osm.bz2
- Open relation manager for
route 66
- Add new middle node south of node
E
- Select new node and node
E
and split way - In relation manager: refresh data and sort completely.
- Undo last action (split way)
- In relation manager: refresh data and discard changes.
What is the expected result?
Changes in relation manager are discarded and data is refreshed from data layer
What happens instead?
IndexOutOfBoundsException: Index 6 out of bounds for length 6
Please provide any additional information below. Attach a screenshot if possible.
Relative:URL: ^/trunk Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b Last:Changed Date: 2020-04-08 18:20:25 +0200 (Wed, 08 Apr 2020) Revision:16245 Build-Date:2020-04-09 01:30:48 URL:https://josm.openstreetmap.de/svn/trunk Last errors/warnings: - W: Unsaved changes - <html>You have unsaved changes in this editor window.<br><br>Do you want to discard these changes and reload data from layer?</html> - E: Handled by bug report queue: java.lang.IndexOutOfBoundsException: Index 6 out of bounds for length 6 === REPORTED CRASH DATA === BugReportExceptionHandler#handleException: No data collected. Warning issued by: BugReportExceptionHandler#handleException === STACK TRACE === Thread: AWT-EventQueue-0 (18) of main java.lang.IndexOutOfBoundsException: Index 6 out of bounds for length 6 at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64) at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70) at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248) at java.base/java.util.Objects.checkIndex(Objects.java:372) at java.base/java.util.ArrayList.get(ArrayList.java:458) at org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel.getSelectedMembers(MemberTableModel.java:525) at org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel.hasIncompleteSelectedMembers(MemberTableModel.java:416) at org.openstreetmap.josm.gui.dialogs.relation.actions.DownloadSelectedIncompleteMembersAction.updateEnabledState(DownloadSelectedIncompleteMembersAction.java:46) at org.openstreetmap.josm.gui.dialogs.relation.actions.AbstractRelationEditorAction.tableChanged(AbstractRelationEditorAction.java:76) at java.desktop/javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:297) at java.desktop/javax.swing.table.AbstractTableModel.fireTableDataChanged(AbstractTableModel.java:199) at org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel.populate(MemberTableModel.java:225) at org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor.populateModels(GenericRelationEditor.java:323) at org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor.reloadDataFromRelation(GenericRelationEditor.java:316) at org.openstreetmap.josm.gui.dialogs.relation.actions.RefreshAction.actionPerformed(RefreshAction.java:65) at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967) at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308) at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405) at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262) at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279) at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297) at java.desktop/java.awt.Component.processMouseEvent(Component.java:6632) at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342) at java.desktop/java.awt.Component.processEvent(Component.java:6397) at java.desktop/java.awt.Container.processEvent(Container.java:2263) at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5008) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4840) at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918) at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547) at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307) at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4840) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90) === RUNNING THREADS === Thread: RemoteControl HTTP Server (48) of main java.base@11.0.6/java.net.PlainSocketImpl.socketAccept(Native Method) java.base@11.0.6/java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:458) java.base@11.0.6/java.net.ServerSocket.implAccept(ServerSocket.java:565) java.base@11.0.6/java.net.ServerSocket.accept(ServerSocket.java:533) app//org.openstreetmap.josm.io.remotecontrol.RemoteControlHttpServer.run(RemoteControlHttpServer.java:104) Thread: AWT-EventQueue-0 (18) of main Stacktrace see above. Thread: main-worker-0 (53) of main java.base@11.0.6/jdk.internal.misc.Unsafe.park(Native Method) java.base@11.0.6/java.util.concurrent.locks.LockSupport.park(LockSupport.java:194) java.base@11.0.6/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2081) java.base@11.0.6/java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:433) java.base@11.0.6/java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1054) java.base@11.0.6/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1114) java.base@11.0.6/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) java.base@11.0.6/java.lang.Thread.run(Thread.java:834) Thread: WeakCollectionCleaner (42) of main java.base@11.0.6/java.lang.Object.wait(Native Method) java.base@11.0.6/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:155) java.base@11.0.6/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:176) org.geotools.util.WeakCollectionCleaner.run(WeakCollectionCleaner.java:65) Thread: Weak reference cleaner (31) of main java.base@11.0.6/java.lang.Object.wait(Native Method) java.base@11.0.6/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:155) java.base@11.0.6/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:176) app//org.openstreetmap.josm.tools.ListenableWeakReference.clean(ListenableWeakReference.java:60) app//org.openstreetmap.josm.tools.ListenableWeakReference$$Lambda$349/0x0000000840438840.run(Unknown Source) java.base@11.0.6/java.lang.Thread.run(Thread.java:834) Thread: RemoteControl HTTP Server (47) of main java.base@11.0.6/java.net.PlainSocketImpl.socketAccept(Native Method) java.base@11.0.6/java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:458) java.base@11.0.6/java.net.ServerSocket.implAccept(ServerSocket.java:565) java.base@11.0.6/java.net.ServerSocket.accept(ServerSocket.java:533) app//org.openstreetmap.josm.io.remotecontrol.RemoteControlHttpServer.run(RemoteControlHttpServer.java:104) Thread: bug-report-display (60) of main java.base@11.0.6/java.lang.Object.wait(Native Method) java.base@11.0.6/java.lang.Object.wait(Object.java:328) app//org.openstreetmap.josm.tools.bugreport.BugReportQueue.getNext(BugReportQueue.java:123) app//org.openstreetmap.josm.tools.bugreport.BugReportQueue.access$100(BugReportQueue.java:17) app//org.openstreetmap.josm.tools.bugreport.BugReportQueue$BugReportDisplayRunnable.run(BugReportQueue.java:99) java.base@11.0.6/java.lang.Thread.run(Thread.java:834) Thread: Map Status Collector (58) of main java.base@11.0.6/jdk.internal.misc.Unsafe.park(Native Method) java.base@11.0.6/java.util.concurrent.locks.LockSupport.park(LockSupport.java:194) java.base@11.0.6/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2081) java.base@11.0.6/java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:433) app//org.openstreetmap.josm.gui.MapStatus$Collector.run(MapStatus.java:434) java.base@11.0.6/java.lang.Thread.run(Thread.java:834) Thread: FileSystemWatchService (29) of main java.base@11.0.6/sun.nio.fs.LinuxWatchService.poll(Native Method) java.base@11.0.6/sun.nio.fs.LinuxWatchService$Poller.run(LinuxWatchService.java:316) java.base@11.0.6/java.lang.Thread.run(Thread.java:834) Thread: Timer-2 (56) of main java.base@11.0.6/java.lang.Object.wait(Native Method) java.base@11.0.6/java.lang.Object.wait(Object.java:328) java.base@11.0.6/java.util.TimerThread.mainLoop(Timer.java:527) java.base@11.0.6/java.util.TimerThread.run(Timer.java:506) Thread: TimerQueue (20) of system java.base@11.0.6/jdk.internal.misc.Unsafe.park(Native Method) java.base@11.0.6/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:234) java.base@11.0.6/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2123) java.base@11.0.6/java.util.concurrent.DelayQueue.take(DelayQueue.java:229) java.desktop@11.0.6/javax.swing.TimerQueue.run(TimerQueue.java:171) java.base@11.0.6/java.lang.Thread.run(Thread.java:834) Thread: message-notifier-0 (49) of main java.base@11.0.6/jdk.internal.misc.Unsafe.park(Native Method) java.base@11.0.6/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:234) java.base@11.0.6/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2123) java.base@11.0.6/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1182) java.base@11.0.6/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:899) java.base@11.0.6/java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1054) java.base@11.0.6/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1114) java.base@11.0.6/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) java.base@11.0.6/java.lang.Thread.run(Thread.java:834) Thread: AWT-XAWT (17) of system java.desktop@11.0.6/sun.awt.X11.XToolkit.waitForEvents(Native Method) java.desktop@11.0.6/sun.awt.X11.XToolkit.run(XToolkit.java:688) java.desktop@11.0.6/sun.awt.X11.XToolkit.run(XToolkit.java:652) java.base@11.0.6/java.lang.Thread.run(Thread.java:834) Thread: File Watcher (30) of main java.base@11.0.6/jdk.internal.misc.Unsafe.park(Native Method) java.base@11.0.6/java.util.concurrent.locks.LockSupport.park(LockSupport.java:194) java.base@11.0.6/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2081) java.base@11.0.6/java.util.concurrent.LinkedBlockingDeque.takeFirst(LinkedBlockingDeque.java:483) java.base@11.0.6/java.util.concurrent.LinkedBlockingDeque.take(LinkedBlockingDeque.java:671) java.base@11.0.6/sun.nio.fs.AbstractWatchService.take(AbstractWatchService.java:118) app//org.openstreetmap.josm.io.FileWatcher.processEvents(FileWatcher.java:120) app//org.openstreetmap.josm.io.FileWatcher$$Lambda$319/0x00000008403bac40.run(Unknown Source) java.base@11.0.6/java.lang.Thread.run(Thread.java:834) Thread: Reference Handler (2) of system java.base@11.0.6/java.lang.ref.Reference.waitForReferencePendingList(Native Method) java.base@11.0.6/java.lang.ref.Reference.processPendingReferences(Reference.java:241) java.base@11.0.6/java.lang.ref.Reference$ReferenceHandler.run(Reference.java:213) Thread: ForkJoinPool.commonPool-worker-5 (86) java.base@11.0.6/jdk.internal.misc.Unsafe.park(Native Method) java.base@11.0.6/java.util.concurrent.locks.LockSupport.parkUntil(LockSupport.java:275) java.base@11.0.6/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1619) java.base@11.0.6/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177) Thread: Common-Cleaner (9) of InnocuousThreadGroup java.base@11.0.6/java.lang.Object.wait(Native Method) java.base@11.0.6/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:155) java.base@11.0.6/jdk.internal.ref.CleanerImpl.run(CleanerImpl.java:148) java.base@11.0.6/java.lang.Thread.run(Thread.java:834) java.base@11.0.6/jdk.internal.misc.InnocuousThread.run(InnocuousThread.java:134) Thread: AWT-Shutdown (19) of system java.base@11.0.6/java.lang.Object.wait(Native Method) java.base@11.0.6/java.lang.Object.wait(Object.java:328) java.desktop@11.0.6/sun.awt.AWTAutoShutdown.run(AWTAutoShutdown.java:291) java.base@11.0.6/java.lang.Thread.run(Thread.java:834) Thread: ForkJoinPool.commonPool-worker-3 (85) of main java.base@11.0.6/jdk.internal.misc.Unsafe.park(Native Method) java.base@11.0.6/java.util.concurrent.locks.LockSupport.park(LockSupport.java:194) java.base@11.0.6/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1628) java.base@11.0.6/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177) Thread: Signal Dispatcher (4) of system Thread: Timer-0 (43) of main java.base@11.0.6/java.lang.Object.wait(Native Method) java.base@11.0.6/java.util.TimerThread.mainLoop(Timer.java:553) java.base@11.0.6/java.util.TimerThread.run(Timer.java:506) Thread: Timer-1 (52) of main java.base@11.0.6/java.lang.Object.wait(Native Method) java.base@11.0.6/java.util.TimerThread.mainLoop(Timer.java:553) java.base@11.0.6/java.util.TimerThread.run(Timer.java:506) Thread: ForkJoinPool.commonPool-worker-1 (72) java.base@11.0.6/jdk.internal.misc.Unsafe.park(Native Method) java.base@11.0.6/java.util.concurrent.locks.LockSupport.parkUntil(LockSupport.java:275) java.base@11.0.6/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1619) java.base@11.0.6/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177) Thread: Finalizer (3) of system java.base@11.0.6/java.lang.Object.wait(Native Method) java.base@11.0.6/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:155) java.base@11.0.6/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:176) java.base@11.0.6/java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:170) Thread: JCS-ElementEventQueue-Thread-1 (40) of main java.base@11.0.6/jdk.internal.misc.Unsafe.park(Native Method) java.base@11.0.6/java.util.concurrent.locks.LockSupport.park(LockSupport.java:194) java.base@11.0.6/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2081) java.base@11.0.6/java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:433) java.base@11.0.6/java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1054) java.base@11.0.6/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1114) java.base@11.0.6/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) java.base@11.0.6/java.lang.Thread.run(Thread.java:834) Thread: changeset-updater-0 (50) of main java.base@11.0.6/jdk.internal.misc.Unsafe.park(Native Method) java.base@11.0.6/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:234) java.base@11.0.6/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2123) java.base@11.0.6/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1182) java.base@11.0.6/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:899) java.base@11.0.6/java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1054) java.base@11.0.6/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1114) java.base@11.0.6/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) java.base@11.0.6/java.lang.Thread.run(Thread.java:834) Thread: Java2D Disposer (13) of system java.base@11.0.6/java.lang.Object.wait(Native Method) java.base@11.0.6/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:155) java.base@11.0.6/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:176) java.desktop@11.0.6/sun.java2d.Disposer.run(Disposer.java:144) java.base@11.0.6/java.lang.Thread.run(Thread.java:834) Thread: GT authority factory disposer (41) of main java.base@11.0.6/java.lang.Object.wait(Native Method) java.base@11.0.6/java.util.TimerThread.mainLoop(Timer.java:553) java.base@11.0.6/java.util.TimerThread.run(Timer.java:506) Thread: DestroyJavaVM (51) of main Thread: styled-map-renderer-1 (74) of main java.base@11.0.6/jdk.internal.misc.Unsafe.park(Native Method) java.base@11.0.6/java.util.concurrent.locks.LockSupport.park(LockSupport.java:194) java.base@11.0.6/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1628) java.base@11.0.6/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177) Thread: Java2D Queue Flusher (15) of system java.base@11.0.6/java.lang.Object.wait(Native Method) java.desktop@11.0.6/sun.java2d.opengl.OGLRenderQueue$QueueFlusher.run(OGLRenderQueue.java:205) java.base@11.0.6/java.lang.Thread.run(Thread.java:834)
Attachments (0)
Change History (9)
comment:1 by , 4 years ago
comment:2 by , 4 years ago
Keywords: | undo added |
---|---|
Version: | → latest |
comment:3 by , 4 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:4 by , 4 years ago
Cc: | added |
---|---|
Keywords: | regression added |
IIGTR this problem is caused by concurrent updates. The undo removes a way which is both in the list of selected ways and in the relation editors selection list.
I think the crash is a regression of r16438. When I change
!#java public Collection<RelationMember> getSelectedMembers() { return Arrays.stream(getSelectedIndices()) .mapToObj(members::get) .collect(Collectors.toList()); }
to
public Collection<RelationMember> getSelectedMembers() { return new ArrayList<>(Arrays.stream(getSelectedIndices()) .mapToObj(members::get) .collect(Collectors.toList())); }
so that the list is really created at that point in time the problem disappears. With the current code it is not materialized and thus the next stream()
operation in
public Collection<OsmPrimitive> getSelectedChildPrimitives() { return getSelectedMembers().stream() .map(RelationMember::getMember) .collect(Collectors.toList()); }
fails.
@simon04
I am not sure if this is a java bug or a general stream problem or something that should be fixed with locks.
comment:5 by , 4 years ago
https://docs.oracle.com/javase/8/docs/api/java/util/stream/Collectors.html
"There are no guarantees on the type, mutability, serializability, or thread-safety of the List returned; if more control over the returned List is required, use toCollection(Supplier).
comment:6 by , 4 years ago
Oops, the problem was reported for r16245, so r16438 cannot be blamed. Still, the usage of Collectors.toList()
in routines which care about the isSelected()
state looks risky.
comment:8 by , 4 years ago
Milestone: | → 20.10 |
---|
Just happened again. It is annoying as you cannot use the command stack panel to undo changes of relations once two relations are saved from their relation manager.
All changes are adding/deleting members and take place within the relation editors