Bug 507226 - The lack of ID can create an unreadable odesign and a NPE
Summary: The lack of ID can create an unreadable odesign and a NPE
Status: NEW
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: 4.1.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2016-11-08 09:04 EST by Stephane Begaudeau CLA
Modified: 2016-11-17 05:03 EST (History)
1 user (show)

See Also:


Attachments
ODesign file used to reproduce the issue (2.23 KB, application/octet-stream)
2016-11-08 09:04 EST, Stephane Begaudeau CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stephane Begaudeau CLA 2016-11-08 09:04:18 EST
Created attachment 265248 [details]
ODesign file used to reproduce the issue

Steps to reproduce:
- Open the odesign file provided
- Add the reconnect tool on the edge
- Add the direct edit tool on the edge (this issue easily appear with a reconnect tool and a direct edit tool on an edge)
- Save
- Close the odesign file
- Reopen it, it cannot be opened anymore

The issue comes from the fact that if a specifier does not enter an unique identifier for some of his/her tools, the reference cannot be properly resolved and as a result EMF tries to load a direct edit tool for a reconnect tool. This issue can be reproduced with pretty much all the elements with an ID in Sirius... to pretty much anything.

So while the user interface indicates that the elements of the odesign must have an identifier, it could be nice to create a default identifier when we are creating a new element and/or when we are saving an odesign because we should be able to determinate that we are saving an odesign that we may not be able to read later.

It also comes with a NPE in ViewpointRegistryImpl (the root is null because EMF has encountered an issue during the loading):

java.lang.NullPointerException
	at org.eclipse.sirius.business.api.componentization.ViewpointRegistryImpl$1.isValid(ViewpointRegistryImpl.java:108)
	at org.eclipse.sirius.business.api.componentization.ViewpointRegistryImpl.reloadFile(ViewpointRegistryImpl.java:844)
	at org.eclipse.sirius.business.api.componentization.ViewpointRegistryImpl.invalidateCacheAndReloadFile(ViewpointRegistryImpl.java:777)
	at org.eclipse.sirius.business.api.componentization.ViewpointRegistryImpl.refreshWorkspaceComponents(ViewpointRegistryImpl.java:719)
	at org.eclipse.sirius.business.api.componentization.ViewpointRegistryImpl.refreshWorkspaceComponents(ViewpointRegistryImpl.java:733)
	at org.eclipse.sirius.business.api.componentization.ViewpointRegistryImpl.refreshWorkspaceComponents(ViewpointRegistryImpl.java:733)
	at org.eclipse.sirius.business.api.componentization.ViewpointRegistryImpl.refreshWorkspaceComponents(ViewpointRegistryImpl.java:733)
	at org.eclipse.sirius.business.api.componentization.ViewpointRegistryImpl.resourceChanged(ViewpointRegistryImpl.java:681)
	at org.eclipse.core.internal.events.NotificationManager$1.run(NotificationManager.java:299)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:289)
	at org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:152)
	at org.eclipse.core.internal.resources.Workspace.broadcastPostChange(Workspace.java:374)
	at org.eclipse.core.internal.resources.Workspace.endOperation(Workspace.java:1469)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2253)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2267)
	at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:128)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)
Comment 1 Florian Barbin CLA 2016-11-17 05:03:25 EST
Issue reproduced and marked as "Triaged"