Community
Participate
Working Groups
On investigation of bug 493008, the following issue was discovered: Initial condition (from attached model): - Capsule1 has a capsulePart typed by Capsule2 . The diagram Capsule1 is kept displayed in the background (not the active one) - On Capsule2, we have a RelayPort protocol1 which is connected to a port from CapsulePart capsule3, typed by Capsule3. Steps for the bug: - Trying to change the RelayPort in Capsule2 diagram to an Internal Behavior Port triggers the NPE (log shown at the end of the comment) The goal here is to understand why the refresh of the BehaviorPortEditPolicy is happening on a view detached from its port. The bug 496252: "[Composite Diagram] NPE in BehaviorPortEditPolicy when port is not available vie getUMLElement()" has been opened on Papyrus to avoid the NPE situation, but it may be interesting to understand the issue leading to this situation. NPE message: !ENTRY org.eclipse.emf.transaction 4 45 2016-06-16 12:19:46.438 !MESSAGE Uncaught exception during post-commit listener notifications !STACK 0 java.lang.NullPointerException at org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies.BehaviorPortEditPolicy.udaptePortBehavior(BehaviorPortEditPolicy.java:80) at org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies.BehaviorPortEditPolicy.notifyChanged(BehaviorPortEditPolicy.java:62) 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 org.eclipse.papyrus.infra.emf.gmf.command.CheckedOperationHistory.doExecute(CheckedOperationHistory.java:206) at org.eclipse.papyrus.infra.emf.gmf.command.CheckedOperationHistory.execute(CheckedOperationHistory.java:195) at org.eclipse.papyrus.infra.emf.gmf.command.NotifyingWorkspaceCommandStack.doExecute(NotifyingWorkspaceCommandStack.java:264) at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:165) at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:219) at org.eclipse.papyrus.infra.emf.gmf.command.NestingNotifyingWorkspaceCommandStack.execute(NestingNotifyingWorkspaceCommandStack.java:130) at org.eclipse.papyrus.uml.tools.databinding.PapyrusObservableValue.doSetValue(PapyrusObservableValue.java:89) at org.eclipse.core.databinding.observable.value.AbstractObservableValue.setValue(AbstractObservableValue.java:66) at org.eclipse.papyrus.infra.tools.databinding.DelegatingObservableValue.setValue(DelegatingObservableValue.java:104) at sun.reflect.GeneratedMethodAccessor79.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.eclipse.papyrus.infra.tools.databinding.DelegatingInvocationHandler.invoke(DelegatingInvocationHandler.java:160) at com.sun.proxy.$Proxy21.setValue(Unknown Source) at org.eclipse.core.databinding.UpdateValueStrategy.doSet(UpdateValueStrategy.java:469) at org.eclipse.core.databinding.ValueBinding$3$1.run(ValueBinding.java:206) at org.eclipse.core.databinding.observable.Realm$1.run(Realm.java:149) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.databinding.observable.Realm.safeRun(Realm.java:153) at org.eclipse.core.databinding.observable.Realm.exec(Realm.java:171) at org.eclipse.core.databinding.ValueBinding$3.run(ValueBinding.java:196) at org.eclipse.core.databinding.observable.Realm$1.run(Realm.java:149) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.databinding.observable.Realm.safeRun(Realm.java:153) at org.eclipse.core.databinding.observable.Realm.exec(Realm.java:171) at org.eclipse.core.databinding.ValueBinding.doUpdate(ValueBinding.java:158) at org.eclipse.core.databinding.ValueBinding.access$4(ValueBinding.java:147) at org.eclipse.core.databinding.ValueBinding$1.handleValueChange(ValueBinding.java:46) at org.eclipse.core.databinding.observable.value.ValueChangeEvent.dispatch(ValueChangeEvent.java:70) at org.eclipse.core.databinding.observable.ChangeManager.fireEvent(ChangeManager.java:117) at org.eclipse.core.databinding.observable.value.AbstractObservableValue.fireValueChange(AbstractObservableValue.java:82) at org.eclipse.core.databinding.observable.value.SelectObservableValue.notifyIfChanged(SelectObservableValue.java:139) at org.eclipse.core.databinding.observable.value.SelectObservableValue.access$3(SelectObservableValue.java:134) at org.eclipse.core.databinding.observable.value.SelectObservableValue$1.handleValueChange(SelectObservableValue.java:62) at org.eclipse.core.databinding.observable.value.ValueChangeEvent.dispatch(ValueChangeEvent.java:70) at org.eclipse.core.databinding.observable.ChangeManager.fireEvent(ChangeManager.java:117) at org.eclipse.core.databinding.observable.value.DecoratingObservableValue.fireValueChange(DecoratingObservableValue.java:61) at org.eclipse.core.databinding.observable.value.DecoratingObservableValue.handleValueChange(DecoratingObservableValue.java:103) at org.eclipse.core.databinding.observable.value.DecoratingObservableValue$1.handleValueChange(DecoratingObservableValue.java:76) at org.eclipse.core.databinding.observable.value.ValueChangeEvent.dispatch(ValueChangeEvent.java:70) at org.eclipse.core.databinding.observable.ChangeManager.fireEvent(ChangeManager.java:117) at org.eclipse.core.databinding.observable.value.AbstractObservableValue.fireValueChange(AbstractObservableValue.java:82) at org.eclipse.core.internal.databinding.property.value.SimplePropertyObservableValue.notifyIfChanged(SimplePropertyObservableValue.java:126) at org.eclipse.core.internal.databinding.property.value.SimplePropertyObservableValue.access$3(SimplePropertyObservableValue.java:118) at org.eclipse.core.internal.databinding.property.value.SimplePropertyObservableValue$1$1.run(SimplePropertyObservableValue.java:70) at org.eclipse.core.databinding.observable.Realm$1.run(Realm.java:149) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.databinding.observable.Realm.safeRun(Realm.java:153) at org.eclipse.core.databinding.observable.Realm.exec(Realm.java:171) at org.eclipse.core.internal.databinding.property.value.SimplePropertyObservableValue$1.handleEvent(SimplePropertyObservableValue.java:66) at org.eclipse.core.databinding.property.NativePropertyListener.fireChange(NativePropertyListener.java:69) at org.eclipse.jface.internal.databinding.swt.WidgetListener.handleEvent(WidgetListener.java:56) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4410) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4228) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3816) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:687) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:604) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610) at org.eclipse.equinox.launcher.Main.run(Main.java:1519) at org.eclipse.equinox.launcher.Main.main(Main.java:1492)
Created attachment 262495 [details] Reproduction model
The CanonicalPortDisplayEditPolicy on the capsulePart in Capsule1 diagram is a PreCommitListener. As the transaction to set the UML/Stereotype values of the RTPort, the CPDEP is deleting the view (which make sense, as a non-service port is supposed to be hidden for capsule parts). However, the view is only detached from the notation model. No further action is performed at the level of the edit part (no deactivation / nothing else). I will continue further investigation
(In reply to Remi Schnekenburger from comment #2) > The CanonicalPortDisplayEditPolicy on the capsulePart in Capsule1 diagram is > a PreCommitListener. As the transaction to set the UML/Stereotype values of > the RTPort, the CPDEP is deleting the view (which make sense, as a > non-service port is supposed to be hidden for capsule parts). > However, the view is only detached from the notation model. No further > action is performed at the level of the edit part (no deactivation / nothing > else). I will continue further investigation Some inputs on linked review 75543. The fix may imply bigger modifications than a simple try/catch
I tried this in the latest Papyrus-RT build, and I am unable to repeat the exception using the attached model and the steps to reproduce. Switching the relay port to an internal behavior port, does no longer trigger an exception.
(In reply to Peter Cigehn from comment #4) > I tried this in the latest Papyrus-RT build, and I am unable to repeat the > exception using the attached model and the steps to reproduce. Switching the > relay port to an internal behavior port, does no longer trigger an exception. Thanks. Indeed, the associated Gerrit draft was superseded by a fix to another problem that deleted the edit-policy responsible for this bug's NPE, so this bug was resolved indirectly.
(In reply to Christian W. Damus from comment #5) > (In reply to Peter Cigehn from comment #4) > > I tried this in the latest Papyrus-RT build, and I am unable to repeat the > > exception using the attached model and the steps to reproduce. Switching the > > relay port to an internal behavior port, does no longer trigger an exception. > > Thanks. Indeed, the associated Gerrit draft was superseded by a fix to > another problem that deleted the edit-policy responsible for this bug's NPE, > so this bug was resolved indirectly. Putting the bug into verified/fixed, as it can not happen anymore, thanks to the class deletion.
even better, "closed" fixed.