Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 496252

Summary: [Composite Diagram] NPE in BehaviorPortEditPolicy when port is not available vie getUMLElement()
Product: [Modeling] Papyrus Reporter: Remi Schnekenburger <rschnekenburger>
Component: DiagramAssignee: Remi Schnekenburger <rschnekenburger>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: give.a.damus, papyrus-bugs
Version: 2.0.0   
Target Milestone: 3.0.0   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/75395
https://git.eclipse.org/c/papyrus/org.eclipse.papyrus.git/commit/?id=6a7d6f70fa43fc592fac80525a6472cb7f87f3d2
https://git.eclipse.org/r/75454
https://git.eclipse.org/r/75535
https://git.eclipse.org/c/papyrus/org.eclipse.papyrus.git/commit/?id=2fc92a7ef3d6e9f1fa8ad93af5ab5442776eb339
https://git.eclipse.org/r/76604
https://git.eclipse.org/c/papyrus/org.eclipse.papyrus.git/commit/?id=1955272c57020bcd4d1ee9eced957eae6f33746e
Whiteboard:
Bug Depends on:    
Bug Blocks: 483637, 496253    

Description Remi Schnekenburger CLA 2016-06-16 06:39:14 EDT
Found in analysis of Papyrus-RT bug 493008 on the Neon.0 release.

The BehaviorPortEditPolicy listens to ports in a Composite Diagram to update their visual presentation when their behaviour nature changes.  However, if the port in question is also being removed from the diagram (which happens in an in-development enhancement to synchronization in Capsule Diagrams), then an NPE results in the updateBehaviorPort method (getUMLElement() may be null).

A simple fix to avoid NPE message is to check the getUMLElement(). Another investigation will be performed on Papyrus-RT to understand why this refresh is poping up on a policy which has a deleted view.
Comment 1 Remi Schnekenburger CLA 2016-06-16 06:48:11 EDT
Log report:

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)
Comment 2 Eclipse Genie CLA 2016-06-16 06:53:51 EDT
New Gerrit change created: https://git.eclipse.org/r/75395
Comment 4 Eclipse Genie CLA 2016-06-17 08:32:38 EDT
New Gerrit change created: https://git.eclipse.org/r/75454
Comment 5 Eclipse Genie CLA 2016-06-20 03:30:28 EDT
New Gerrit change created: https://git.eclipse.org/r/75535
Comment 6 Eclipse Genie CLA 2016-06-21 08:56:33 EDT
Gerrit change https://git.eclipse.org/r/75454 was merged to [streams/2.0-maintenance].
Commit: http://git.eclipse.org/c/papyrus/org.eclipse.papyrus.git/commit/?id=2fc92a7ef3d6e9f1fa8ad93af5ab5442776eb339
Comment 7 Eclipse Genie CLA 2016-07-05 09:27:48 EDT
New Gerrit change created: https://git.eclipse.org/r/76604
Comment 8 Eclipse Genie CLA 2016-07-05 09:29:55 EDT
New Gerrit change created: https://git.eclipse.org/r/76604
Comment 9 Patrick Tessier CLA 2016-07-05 10:59:23 EDT
done in the oxygen and neon version
Comment 10 Eclipse Genie CLA 2016-07-06 00:00:23 EDT
Gerrit change https://git.eclipse.org/r/76604 was merged to [streams/2.0-maintenance].
Commit: http://git.eclipse.org/c/papyrus/org.eclipse.papyrus.git/commit/?id=1955272c57020bcd4d1ee9eced957eae6f33746e