Opened 18 months ago

Closed 18 months ago

Last modified 17 months ago

#20213 closed defect (fixed)

Command stack: Edits in relation editor are listed in wrong stack and lead to exception.

Reported by: skyper Owned by: GerdP
Priority: major Milestone:
Component: Core Version: latest
Keywords: template_report command stack relation editor Cc:


It seems #17196 is not completely fixed, yet.

What steps will reproduce the problem?

  1. Have to data layers one with at least one relation
  2. Open the relation in relation manager
  3. Switch active layer to the one without the relation
  4. Make some changes in relation editor and save + close
  5. Look at comman stack and notice a relation with negative id
  6. Undo last change
  7. Switch active layers back and for
  8. Redo change

What is the expected result?

  1. The command stack for the layer where the relation was opened from needs to list the changes in the relation editor
  2. No exception after redo
  3. No new "clone" relation but proper changes of the existing relation

What happens instead?

  1. The wrong command stack is used.
  2. ArrayIndexOutOfBoundsException
  3. New "clone" relation instead of changing the existing relation

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

The relation editor always needs to be tied to one data set and only this layer should be changed and only its command stack be used.

Do not know what to do when layers are merged, but guess the datasets shoud be merged. We need to catch this situation as otherwise multiple relation editors could be open for the same relation in the same dataset or some will loose their dataset.

Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2020-12-07 15:40:50 +0100 (Mon, 07 Dec 2020)
Build-Date:2020-12-08 02:30:55

Identification: JOSM/1.5 (17396 en) Linux Debian GNU/Linux 10 (buster)
Java version:, Debian, OpenJDK 64-Bit Server VM

Dataset consistency test: No problems found

Last errors/warnings:
- 07910.694 E: Handled by bug report queue: java.lang.ArrayIndexOutOfBoundsException: 0 >= 0

No data collected.

Warning issued by: BugReportExceptionHandler#handleException

Thread: AWT-EventQueue-0 (18) of main
java.lang.ArrayIndexOutOfBoundsException: 0 >= 0
	at java.base/java.util.Vector.elementAt(
	at java.desktop/javax.swing.tree.DefaultMutableTreeNode.getChildAt(
	at org.openstreetmap.josm.gui.dialogs.CommandStackDialog.swapNode(
	at org.openstreetmap.josm.gui.dialogs.CommandStackDialog.commandRedone(
	at java.base/java.lang.Iterable.forEach(
	at org.openstreetmap.josm.actions.RedoAction.actionPerformed(
	at java.desktop/javax.swing.AbstractButton.fireActionPerformed(
	at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(
	at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(
	at java.desktop/javax.swing.DefaultButtonModel.setPressed(
	at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(
	at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(
	at java.desktop/java.awt.Component.processMouseEvent(
	at java.desktop/javax.swing.JComponent.processMouseEvent(
	at java.desktop/java.awt.Component.processEvent(
	at java.desktop/java.awt.Container.processEvent(
	at java.desktop/java.awt.Component.dispatchEventImpl(
	at java.desktop/java.awt.Container.dispatchEventImpl(
	at java.desktop/java.awt.Component.dispatchEvent(
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(
	at java.desktop/java.awt.Container.dispatchEventImpl(
	at java.desktop/java.awt.Window.dispatchEventImpl(
	at java.desktop/java.awt.Component.dispatchEvent(
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(
	at java.desktop/java.awt.EventQueue$
	at java.desktop/java.awt.EventQueue$
	at java.base/ Method)
	at java.base/$JavaSecurityAccessImpl.doIntersectionPrivilege(
	at java.base/$JavaSecurityAccessImpl.doIntersectionPrivilege(
	at java.desktop/java.awt.EventQueue$
	at java.desktop/java.awt.EventQueue$
	at java.base/ Method)
	at java.base/$JavaSecurityAccessImpl.doIntersectionPrivilege(
	at java.desktop/java.awt.EventQueue.dispatchEvent(
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(
	at java.desktop/

Attachments (0)

Change History (8)

comment:1 Changed 18 months ago by skyper

Priority: normalmajor

comment:2 Changed 18 months ago by GerdP

Owner: changed from team to GerdP
Status: newassigned

comment:3 Changed 18 months ago by GerdP

I cannot reproduce the crash but I see the command in the wrong stack. Would it be an option to hide the relation editor windows which don't belong the active layer?

comment:4 Changed 18 months ago by skyper

I do not think hiding is a good idea, as right now I can select object if they are present in the active layer, which is nice. What does happen if you delete an inactive layer and the relation editor is still open with unsaved changes? What does happen when layers are merged?

Each relation editor needs to be directly tied to one dataset/layer and only objects from this layer are allowed to be added. If the relation is saved from relation editor these changes need to be made in this layer and its command stack.

comment:5 Changed 18 months ago by GerdP

Argh. Merging layers while relation editor is open is surely a good source for problems. I'll see if I find a simple solution. If not, I'll revert the changes for #17196.

comment:6 Changed 18 months ago by skyper

Deleting and merging layers with an open relation manager is not a new problem. We need at least a warning and the relation editor should be closed or tied to the new layer.

One step in this direction might be #10032.

comment:7 Changed 18 months ago by GerdP

Resolution: fixed
Status: assignedclosed

In 17399/josm:

fix #20213: Command stack: Edits in relation editor are listed in wrong stack and lead to exception

  • revert changes for #17196, this approach was too simple because relation editor may save changes for an inactive edit layer

comment:8 Changed 17 months ago by GerdP

Do I set a milestone for tickets which don't concern tested versions?

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain GerdP.
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.