Bug 580461 - Invalid DRepresentationDescritpor can produce NPE in SessionDetailsReport
Summary: Invalid DRepresentationDescritpor can produce NPE in SessionDetailsReport
Status: RESOLVED FIXED
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: 6.6.0   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 6.7.0   Edit
Assignee: Laurent Redor CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on: 580424
Blocks:
  Show dependency tree
 
Reported: 2022-07-27 06:15 EDT by Laurent Redor CLA
Modified: 2022-07-27 09:45 EDT (History)
1 user (show)

See Also:


Attachments
580424-Sirius6.6.0.zip (2.41 KB, application/x-zip-compressed)
2022-07-27 08:02 EDT, Laurent Redor CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Laurent Redor CLA 2022-07-27 06:15:55 EDT
+++ This bug was initially created as a clone of Bug #580424 +++

The Sirius Session Details property page (available in right-click contextual menu > Properties of .aird files) throws the following NPE when representations without target are present in the session:

> java.lang.NullPointerException: Cannot invoke "org.eclipse.emf.ecore.EObject.eClass()" because "this.eObject" is null
>	at org.eclipse.sirius.model.business.internal.query.EObjectQuery.getGenericDecription(EObjectQuery.java:326)
>	at org.eclipse.sirius.business.api.query.EObjectQuery.getGenericDecription(EObjectQuery.java:361)
>	at org.eclipse.sirius.business.internal.query.SessionDetailsReport.addRepresentationDescriptorExtendedInfo(SessionDetailsReport.java:310)
>	at org.eclipse.sirius.business.internal.query.SessionDetailsReport.lambda$9(SessionDetailsReport.java:178)
>	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
>	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
>	at org.eclipse.sirius.business.internal.query.SessionDetailsReport.addRepresentationsInformation(SessionDetailsReport.java:176)
>	at org.eclipse.sirius.business.internal.query.SessionDetailsReport.getSessionFormattedInformation(SessionDetailsReport.java:125)
>	at org.eclipse.sirius.ui.business.internal.session.SiriusSessionDetailsPropertyPage.getSessionInformation(SiriusSessionDetailsPropertyPage.java:100)
>	at org.eclipse.sirius.ui.business.internal.session.SiriusSessionDetailsPropertyPage$3.run(SiriusSessionDetailsPropertyPage.java:177)
>	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)


Sirius representations can detected/categorized as invalid when 
* they have a dangling target (null, proxy or not found in the session)
* the representation cannot be reached from its descriptor: no repPath, or no representation at location pointed by the repPath. 

The invalid representations are grayed in the ui. 

They are also tagged with [invalid] tag in the SessionDetailsReport result which is displayed in the .aird properties (from contextual menu).
In some tools like Team for Capella, this result is also used for project checks/report during automatic backup.
Comment 1 Laurent Redor CLA 2022-07-27 08:02:09 EDT
Created attachment 288648 [details]
580424-Sirius6.6.0.zip

Step to reproduce/validate
* Open the attached project
* Open the session 
* Right click the .aird and then click on the Properties menu
* Select the Sirius Session Details tab
* You must have no NPE

Notes: 
* repDesc can be manually corrupted to remove target, repPath or representation
* in Capella or other advanced workbenches based on Sirius, user cannot get a representation descriptor by simple actions : Delete action is hooked with impact analysis and automatic deletion of Diagram/Tables whose target is being deleted.
Comment 2 Eclipse Genie CLA 2022-07-27 08:03:32 EDT
New Gerrit change created: https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/194900