Removing transition causes exception

Issue #211 resolved
Matthias Schoettle created an issue

When trying to remove a transition in a state view an exception occurs.

In my case I have one state with two self-transitions and I tried to remove one of them.

Exception:

org.eclipse.emf.common.util.WrappedException: An exception was ignored during command execution
    at org.eclipse.emf.common.command.BasicCommandStack.handleError(BasicCommandStack.java:281)
    at org.eclipse.emf.common.command.BasicCommandStack.execute(BasicCommandStack.java:112)
    at ca.mcgill.sel.ram.controller.BaseController.doExecute(BaseController.java:105)
    at ca.mcgill.sel.ram.controller.TransitionController.deleteTransition(TransitionController.java:49)
    at ca.mcgill.ram.ui.handler.state.impl.TransitionViewHandler$1.elementSelected(TransitionViewHandler.java:73)
    at ca.mcgill.ram.ui.handler.state.impl.TransitionViewHandler$1.elementSelected(TransitionViewHandler.java:1)
    at ca.mcgill.ram.ui.components.RamSelectorComponent.selectElement(RamSelectorComponent.java:779)
    at ca.mcgill.ram.ui.components.RamSelectorComponent.access$5(RamSelectorComponent.java:777)
    at ca.mcgill.ram.ui.components.RamSelectorComponent$InternalSelectorHandler.processTapEvent(RamSelectorComponent.java:188)
    at ca.mcgill.ram.ui.handler.BaseHandler.processGestureEvent(BaseHandler.java:78)
[...]
Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
    at org.eclipse.emf.common.util.BasicEList.remove(BasicEList.java:605)
    at org.eclipse.emf.common.notify.impl.NotifyingListImpl.doRemove(NotifyingListImpl.java:756)
    at org.eclipse.emf.common.notify.impl.NotifyingListImpl.remove(NotifyingListImpl.java:707)
    at org.eclipse.emf.edit.command.RemoveCommand.doExecute(RemoveCommand.java:321)
    at org.eclipse.emf.edit.command.AbstractOverrideableCommand.execute(AbstractOverrideableCommand.java:125)
    at org.eclipse.emf.common.command.CompoundCommand.execute(CompoundCommand.java:261)
    at org.eclipse.emf.common.command.BasicCommandStack.execute(BasicCommandStack.java:78)
    ... 38 more

This causes two other exceptions:

Exception in thread "Animation Thread" java.lang.NullPointerException
    at ca.mcgill.sel.ram.validator.ValidationManager.commandStackChanged(ValidationManager.java:246)
    at org.eclipse.emf.common.command.BasicCommandStack.notifyListeners(BasicCommandStack.java:270)
org.eclipse.emf.common.util.WrappedException: An exception was ignored during command execution
    at org.eclipse.emf.common.command.CompoundCommand.execute(CompoundCommand.java:290)
[...]
Caused by: java.lang.NullPointerException
    at ca.mcgill.ram.ui.views.RelationshipView.updateLines(RelationshipView.java:606)
    at ca.mcgill.ram.ui.views.state.StateMachineView.buildTransition(StateMachineView.java:156)
    at ca.mcgill.ram.ui.views.state.StateMachineView.notifyChanged(StateMachineView.java:250)

Comments (6)

  1. Matthias Schoettle reporter

    I suspect it is either the order of how commands are executed or the fact that for everything, even for just removing from a reference, RemoveCommands are used, which I think also try to remove from the owner.

  2. Matthias Schoettle reporter

    Also in StateMachineView.removeTransitionView(Transition) the transition is removed from the state's ingoing and outgoing lists, which should not be done manually in the view.

  3. Matthias Schoettle reporter

    Also, when undoing the adding of a transition, a dangling reference occurs: The transition is still in the State's incoming/outgoing transitions.

  4. Matthias Schoettle reporter

    Resolved issue #211: Adding and removing of transitions properly done now through commands, which allows to undo them as well without running into problems in the UI or dangling references.

    → <<cset 8b6f16b3ec06>>

  5. Log in to comment