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

Bug 511763

Summary: NPE in PermissionService during session open
Product: [Modeling] Sirius Reporter: Koen Staal <koen.staal>
Component: CoreAssignee: Pierre-Charles David <pierre-charles.david>
Status: CLOSED FIXED QA Contact: Laurent Fasani <laurent.fasani>
Severity: normal    
Priority: P3 CC: laurent.fasani, laurent.redor, pierre-charles.david
Version: 4.1.1Keywords: triaged
Target Milestone: 5.0.0M7   
Hardware: PC   
OS: Windows 7   
See Also: https://git.eclipse.org/r/93679
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=11a08da87535d6321668a6e1365025288cb592e4
Whiteboard:
Attachments:
Description Flags
Sample projects to try to reproduce the issue none

Description Koen Staal CLA 2017-02-06 08:26:39 EST
Sirius version 4.1.2
Eclipse Version: Neon.1a Release (4.6.1)

When opening a diagram nothing happend after the Progress monitor. Stacktrace showed a NPE in the PermissionService. After the NPE it tries to close and dispose the permissionProvider and the same NPE happens again.

Caused by: java.lang.NullPointerException
	at org.eclipse.sirius.ecore.extender.business.internal.permission.PermissionService.createPermissionAuthority(PermissionService.java:89)
	at org.eclipse.sirius.ecore.extender.business.internal.permission.PermissionAuthorityRegistryImpl.getPermissionAuthority(PermissionAuthorityRegistryImpl.java:72)
	at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.doDisposePermissionAuthority(DAnalysisSessionImpl.java:1377)
	at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.close(DAnalysisSessionImpl.java:1305)

permissionProvider returned from the descripter is null
Comment 1 Laurent Redor CLA 2017-02-07 09:39:50 EST
It's difficult to analyse just with the stack trace. Do you have steps to reproduce?

Did you use the extension point "org.eclipse.sirius.ecore.extender.PermissionProvider"?

On line PermissionService.java:88 (just before the NPE), do you have the id of the incriminated permissionProviderDescriptor?
Comment 2 Pierre-Charles David CLA 2017-03-22 06:57:00 EDT
The problem was probably triggered by a misconfigured PermissionProvider, but Sirius should be more resilient to these. We should:
* trace the original error which prevented us to instantiate the PermissionProvider;
* check the result of permissionProviderDescriptor.getPermissionProvider() in org.eclipse.sirius.ecore.extender.business.internal.permission.PermissionService.createPermissionAuthority(ResourceSet).
Comment 3 Pierre-Charles David CLA 2017-03-22 06:58:51 EDT
Created attachment 267398 [details]
Sample projects to try to reproduce the issue

Steps to reproduce:
1. Import the attached project. It contains a buggy permissionProvider extension.
2. Launch a runtime.
3. Create/open a Sirius session => NPE.

Caused by: java.lang.NullPointerException
	at org.eclipse.sirius.ecore.extender.business.internal.permission.PermissionService.createPermissionAuthority(PermissionService.java:89)
	at org.eclipse.sirius.ecore.extender.business.internal.permission.PermissionAuthorityRegistryImpl.getPermissionAuthority(PermissionAuthorityRegistryImpl.java:72)
	at org.eclipse.sirius.ui.tools.internal.views.modelexplorer.PermissionAuthoritySessionManagerListener.notifyRemoveSession(PermissionAuthoritySessionManagerListener.java:55)
	at org.eclipse.sirius.business.internal.session.SessionManagerImpl.remove(SessionManagerImpl.java:167)
	at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.close(DAnalysisSessionImpl.java:1296)
	at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.open(DAnalysisSessionImpl.java:1201)
	at org.eclipse.sirius.business.internal.session.SessionManagerImpl.openSession(SessionManagerImpl.java:390)
	at org.eclipse.sirius.ui.tools.internal.views.common.modelingproject.OpenRepresentationsFileJob.performOpenSession(OpenRepresentationsFileJob.java:157)
	at org.eclipse.sirius.ui.tools.internal.views.common.modelingproject.OpenRepresentationsFileJob.runInWorkspace(OpenRepresentationsFileJob.java:126)
	... 2 more
Comment 4 Eclipse Genie CLA 2017-03-23 04:47:07 EDT
New Gerrit change created: https://git.eclipse.org/r/93679
Comment 6 Pierre-Charles David CLA 2017-04-04 11:40:25 EDT
Fixed by 11a08da87535d6321668a6e1365025288cb592e4.
Comment 7 Laurent Fasani CLA 2017-05-19 10:13:19 EDT
Validated with ODCE10.0_20170518
Comment 8 Pierre-Charles David CLA 2017-06-29 03:33:01 EDT
Available in Sirius 5.0.0, see https://wiki.eclipse.org/Sirius/5.0.0 for details.