Bug 514787 - [StateMachineDiagram] NPE in CustomRegionPreDeleteCommand
Summary: [StateMachineDiagram] NPE in CustomRegionPreDeleteCommand
Status: NEW
Alias: None
Product: Papyrus
Classification: Modeling
Component: Diagram (show other bugs)
Version: 2.1.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Ansgar Radermacher CLA
QA Contact:
URL:
Whiteboard: blockingpapyrusrt
Keywords:
Depends on:
Blocks: 514854
  Show dependency tree
 
Reported: 2017-04-05 11:53 EDT by Christian Damus CLA
Modified: 2017-08-02 11:41 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Damus CLA 2017-04-05 11:53:41 EDT
+++ This bug was initially created as a clone of Bug #513166 +++

Eclipse Neon.3
Papyrus Neon.3
Papyrus-RT 0.9+ (latest git master as of 5 April 2017)

When deleting a state machine in Papyrus-RT, we get an NPE in CustomRegionPreDeleteCommand because it doesn't check whether the region shape that it's operating on still exists (has not, itself, been deleted).

Steps to reproduce:

1. Create a new UML-RT model with the "UML-RT for C++" template (enables state machines).
2. Create three capsules A, B, C with generalization relationships C --|> B --|> A.
3. In A, create a State Machine.
4. If necessary, in C create a state machine diagram for the inherited state machine.
5. Open the state machine diagram for C if it is not already open.
6. Delete A's state machine.
7. Observe the exception below, in the log.

!ENTRY org.eclipse.emf.transaction 4 45 2017-04-05 11:45:37.616
!MESSAGE Uncaught exception during post-commit listener notifications
!STACK 0
java.lang.NullPointerException
	at org.eclipse.papyrus.uml.diagram.statemachine.custom.commands.CustomRegionPreDeleteCommand.doExecuteWithResult(CustomRegionPreDeleteCommand.java:51)
	at org.eclipse.papyrus.uml.diagram.statemachine.custom.commands.CustomRegionDeleteCommand.doExecuteWithResult(CustomRegionDeleteCommand.java:37)
	at org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand.doExecute(AbstractTransactionalCommand.java:247)
	at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
	at org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy.execute(ICommandProxy.java:68)
	at org.eclipse.gef.commands.CompoundCommand.execute(CompoundCommand.java:129)
	at org.eclipse.papyrus.uml.diagram.common.editpolicies.OrphanViewPolicy$1.doExecute(OrphanViewPolicy.java:260)
	at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
	at org.eclipse.papyrus.uml.diagram.common.editpolicies.OrphanViewPolicy.executeCommand(OrphanViewPolicy.java:266)
	at org.eclipse.papyrus.uml.diagram.common.editpolicies.OrphanViewPolicy.deleteViews(OrphanViewPolicy.java:227)
	at org.eclipse.papyrus.uml.diagram.common.editpolicies.OrphanViewPolicy.notifyChanged(OrphanViewPolicy.java:410)
	at org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker.fireNotification(DiagramEventBroker.java:504)
	at org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker.resourceSetChanged(DiagramEventBroker.java:399)
	at org.eclipse.gmf.runtime.diagram.ui.DiagramEventBrokerThreadSafe.resourceSetChanged(DiagramEventBrokerThreadSafe.java:73)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl$1.run(TransactionalEditingDomainImpl.java:781)
	at org.eclipse.papyrus.infra.emf.readonly.PapyrusROTransactionalEditingDomain.runExclusive(PapyrusROTransactionalEditingDomain.java:271)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.postcommit(TransactionalEditingDomainImpl.java:771)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.deactivate(TransactionalEditingDomainImpl.java:543)
	at org.eclipse.emf.transaction.impl.TransactionImpl.close(TransactionImpl.java:712)
	at org.eclipse.emf.transaction.impl.TransactionImpl.commit(TransactionImpl.java:474)
	at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:155)
	at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:488)
	at ...