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

Bug 435087

Summary: Sirius decorator providers failing on Papyrus diagrams
Product: [Modeling] Sirius Reporter: Camille Letavernier <cletavernier>
Component: DiagramAssignee: Maxime Porhel <maxime.porhel>
Status: CLOSED FIXED QA Contact: Julien Dupont <julien.dupont>
Severity: normal    
Priority: P3 CC: julien.dupont, maxime.porhel
Version: 1.0.0Keywords: triaged
Target Milestone: 1.0.0   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 435182    
Bug Blocks:    
Attachments:
Description Flags
Use case to check SubDiagramDecorator in Sirius. none

Description Camille Letavernier CLA 2014-05-16 12:17:41 EDT
When running Papyrus with Sirius installed, there is a decorator provider which is failing:

Ignoring provider org.eclipse.sirius.diagram.ui.tools.internal.providers.decorators.SubDiagramDecoratorProvider since it threw an exception or error in the provides() method

java.lang.NullPointerException
	at org.eclipse.sirius.diagram.ui.tools.internal.providers.decorators.SubDiagramDecoratorProvider.provides(SubDiagramDecoratorProvider.java:63)
	at org.eclipse.gmf.runtime.diagram.ui.internal.services.decorator.DecoratorService$ProviderDescriptor.provides(DecoratorService.java:76)
	at org.eclipse.gmf.runtime.common.core.service.Service.safeProvides(Service.java:859)
	at org.eclipse.gmf.runtime.common.core.service.ExecutionStrategy.getUncachedProviders(ExecutionStrategy.java:254)
	at org.eclipse.gmf.runtime.common.core.service.Service.getProviders(Service.java:537)
	at org.eclipse.gmf.runtime.common.core.service.ExecutionStrategy$4.execute(ExecutionStrategy.java:178)
	at org.eclipse.gmf.runtime.common.core.service.Service.execute(Service.java:651)
	at org.eclipse.gmf.runtime.diagram.ui.internal.services.decorator.DecoratorService.createDecorators(DecoratorService.java:121)
	at org.eclipse.gmf.runtime.diagram.ui.editpolicies.DecorationEditPolicy.refresh(DecorationEditPolicy.java:184)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart$3.run(GraphicalEditPart.java:858)
	[...]
	
Other decorator providers from Sirius look OK

Note that the exception is properly caught by GMF and doesn't cause any harm to Papyrus (Except a minor log pollution), but will probably have side effects to Sirius itself afterwards
Comment 1 Maxime Porhel CLA 2014-05-19 04:48:43 EDT
Hi Camille, 

Could you provide a reproduction case ? I see the potential NPE in the code, but it will be easier to validate the issue if we have a use case. 

I tried with Luna M7 +Papyrus M7 + Sirius M7 on several Papyrus diagram ans I did not managed to get the NPE. 

Could give us at least some steps or diagram type ?
Comment 2 Camille Letavernier CLA 2014-05-19 06:36:19 EDT
> Could you provide a reproduction case ? I see the potential NPE in the code, but it will be easier to validate the issue if we have a use case.

I had one model which was always failing on this decorator, but I don't remember which one. I had patched locally the NPE and it solved the issue. Now, if I revert the patch, I'm not able to reproduce the issue anymore. I'm not sure what changed
Comment 3 Maxime Porhel CLA 2014-05-19 06:48:27 EDT
Created attachment 243238 [details]
Use case to check SubDiagramDecorator in Sirius.

I have attached a use case to check SubDiagramDecorator in Sirius. It will allow to check that the changes on the SubDiagramDecoratorProvider context declaration do not introduce regressions in Sirius. 

Camille, could you indicate how to get the NPE in Papyrus ? We will be able to check it does not occur anymore.
Comment 4 Maxime Porhel CLA 2014-05-19 08:19:12 EDT
See https://git.eclipse.org/r/#/c/26845/ (avoid the NPE) and https://git.eclipse.org/r/#/c/26846/ (provider context scope reduction)
Comment 5 Maxime Porhel CLA 2014-05-19 10:43:39 EDT
org.eclipse.sirius.diagram.ui.edit.api.part.IAbstractDiagramNodeEditPart and org.eclipse.sirius.diagram.ui.edit.api.part.IDiagramEdgeEditPart are two top-level interfaces to replace org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart in the context definition for Sirius descriptor providers extensions. It handles our primary edit parts: node, container, list, border node and edge.
Comment 6 Maxime Porhel CLA 2014-05-20 10:59:52 EDT
Fixed in commits
 . dc53b3e5af4bd35599c0f903b360472ecca50c05
 . 5e649ff3e1bb21d645f9ef2b45fa507b4176437b
 . 5df8b58dd7472f89946c7803b3c17a42824c7ee7
Comment 7 Pierre-Charles David CLA 2014-06-25 10:14:46 EDT
Available in Sirius 1.0.0.