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

Bug 453545

Summary: Validation of VSM should detect variables with empty name
Product: [Modeling] Sirius Reporter: Olivier Haegi <olivier.haegi>
Component: DiagramAssignee: Project Inbox <sirius.diagram-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: belqassim.djafer, esteban.dugueperoux, jessy.mallet, maxime.porhel, pierre-charles.david
Version: 2.0.0Keywords: triaged
Target Milestone: 3.0.0M5   
Hardware: PC   
OS: Windows 8   
See Also: https://git.eclipse.org/r/71860
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=4edb4623427ecdcb39c99fd63b24b3c083e3307e
Whiteboard:
Bug Depends on: 447669    
Bug Blocks:    

Description Olivier Haegi CLA 2014-11-28 11:24:31 EST
When trying to open a diagram from "Model Explorer" view, if this diagram was created from another diagram with the popup creation tool, a NPE is raised.
This diagram is successfully opened (without exception) in the case of an opening from the diagram of creation (using the navigation tool).

I can not join my odesign file to this issue, but you can contact me in private if you can't reproduce the case.


java.lang.NullPointerException
	at org.eclipse.sirius.common.acceleo.mtl.business.internal.interpreter.AcceleoMTLInterpreter.createCompilationContext(AcceleoMTLInterpreter.java:521)
	at org.eclipse.sirius.common.acceleo.mtl.business.internal.interpreter.AcceleoMTLInterpreter.internalEvaluate(AcceleoMTLInterpreter.java:1180)
	at org.eclipse.sirius.common.acceleo.mtl.business.internal.interpreter.AcceleoMTLInterpreter.evaluateCollection(AcceleoMTLInterpreter.java:638)
	at org.eclipse.sirius.tools.internal.interpreter.ODesignGenericInterpreter.evaluateCollection(ODesignGenericInterpreter.java:137)
	at org.eclipse.sirius.diagram.business.api.query.DiagramElementMappingQuery.evaluateCandidateExpression(DiagramElementMappingQuery.java:443)
	at org.eclipse.sirius.diagram.business.internal.experimental.sync.AbstractSynchronizerHelper.evaluateCandidateExpression(AbstractSynchronizerHelper.java:120)
	at org.eclipse.sirius.diagram.business.internal.experimental.sync.AbstractSynchronizerHelper.getSemanticCandidates(AbstractSynchronizerHelper.java:189)
	at org.eclipse.sirius.diagram.business.internal.experimental.sync.DNodeSynchronizerHelper.computeNodeCandidates(DNodeSynchronizerHelper.java:61)
	at org.eclipse.sirius.diagram.business.internal.experimental.sync.DDiagramSynchronizer.computeNodeCandidates(DDiagramSynchronizer.java:1137)
	at org.eclipse.sirius.diagram.business.internal.experimental.sync.MappingsUpdater$MappingUpdateVisitor.getNodeCandidates(MappingsUpdater.java:209)
	at org.eclipse.sirius.diagram.business.internal.experimental.sync.MappingsUpdater$MappingUpdateVisitor.visit(MappingsUpdater.java:130)
	at org.eclipse.sirius.diagram.business.internal.componentization.mappings.DiagramMappingsManagerImpl.iterateOnMappings(DiagramMappingsManagerImpl.java:389)
	at org.eclipse.sirius.diagram.business.internal.componentization.mappings.DiagramMappingsManagerImpl.safeIterate(DiagramMappingsManagerImpl.java:371)
	at org.eclipse.sirius.diagram.business.internal.componentization.mappings.DiagramMappingsManagerImpl.iterate(DiagramMappingsManagerImpl.java:361)
	at org.eclipse.sirius.diagram.business.internal.experimental.sync.MappingsUpdater.safeUpdateMappings(MappingsUpdater.java:92)
	at org.eclipse.sirius.diagram.business.internal.experimental.sync.MappingsUpdater.updateMappings(MappingsUpdater.java:84)
	at org.eclipse.sirius.diagram.business.internal.experimental.sync.MappingsUpdater.updateMappings(MappingsUpdater.java:71)
	at org.eclipse.sirius.diagram.business.internal.experimental.sync.DDiagramSynchronizer.refreshOperation(DDiagramSynchronizer.java:381)
	at org.eclipse.sirius.diagram.business.internal.experimental.sync.DDiagramSynchronizer.refresh(DDiagramSynchronizer.java:340)
	at org.eclipse.sirius.diagram.business.internal.sync.DDiagramSynchronizer.refresh(DDiagramSynchronizer.java:91)
	at org.eclipse.sirius.diagram.business.internal.dialect.DiagramDialectServices.refresh(DiagramDialectServices.java:238)
	at org.eclipse.sirius.business.internal.dialect.DialectManagerImpl.refresh(DialectManagerImpl.java:117)
	at org.eclipse.sirius.business.internal.dialect.DialectManagerImpl.refresh(DialectManagerImpl.java:105)
	at org.eclipse.sirius.diagram.ui.business.internal.command.RefreshDiagramOnOpeningCommand.doExecute(RefreshDiagramOnOpeningCommand.java:61)
	at org.eclipse.emf.transaction.RecordingCommand.execute(RecordingCommand.java:135)
	at org.eclipse.emf.common.command.CompoundCommand.execute(CompoundCommand.java:261)
	at org.eclipse.emf.workspace.EMFCommandOperation.doExecute(EMFCommandOperation.java:119)
	at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
	at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:513)
	at org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl.doExecute(WorkspaceCommandStackImpl.java:208)
	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.sirius.diagram.ui.tools.internal.editor.DDiagramEditorImpl.launchRefresh(DDiagramEditorImpl.java:1236)
	at org.eclipse.sirius.diagram.ui.tools.internal.editor.DDiagramEditorImpl.initializeGraphicalViewer(DDiagramEditorImpl.java:1441)
	at org.eclipse.sirius.diagram.ui.tools.internal.editor.DDiagramEditorImpl.createOriginalGraphicalViewer(DDiagramEditorImpl.java:1408)
	at org.eclipse.sirius.diagram.ui.tools.internal.editor.DDiagramEditorImpl.createMainDiagramSection(DDiagramEditorImpl.java:1328)
	at org.eclipse.sirius.diagram.ui.tools.internal.editor.DDiagramEditorImpl.createGraphicalViewer(DDiagramEditorImpl.java:1317)
	at org.eclipse.gef.ui.parts.GraphicalEditor.createPartControl(GraphicalEditor.java:171)
	at org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor.createPartControl(DiagramEditor.java:1580)
	at org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditorWithFlyOutPalette.createPartControl(DiagramEditorWithFlyOutPalette.java:328)
	at org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor.createPartControl(DiagramDocumentEditor.java:1514)
	at org.eclipse.sirius.diagram.ui.tools.internal.editor.DDiagramEditorImpl.createPartControl(DDiagramEditorImpl.java:426)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.createPartControl(CompatibilityPart.java:141)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor.createPartControl(CompatibilityEditor.java:99)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:327)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:888)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:869)
	at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:120)
	at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:337)
	at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:258)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:104)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:73)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:55)
	at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:127)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:983)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:662)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:766)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:737)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:731)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:715)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl$1.handleEvent(PartServiceImpl.java:94)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:40)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:187)
	at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:156)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:4734)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:218)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:36)
	at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:197)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
	at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135)
	at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78)
	at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39)
	at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:81)
	at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:59)
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
	at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:171)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.showElementInWindow(ModelServiceImpl.java:488)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.bringToTop(ModelServiceImpl.java:454)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.delegateBringToTop(PartServiceImpl.java:694)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.bringToTop(PartServiceImpl.java:387)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:1134)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:3210)
	at org.eclipse.ui.internal.WorkbenchPage.access$23(WorkbenchPage.java:3125)
	at org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.java:3107)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3102)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3066)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3047)
	at org.eclipse.sirius.diagram.ui.business.internal.dialect.DiagramDialectUIServices$1.run(DiagramDialectUIServices.java:199)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:187)
	at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:156)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:4734)
	at org.eclipse.sirius.diagram.ui.business.internal.dialect.DiagramDialectUIServices.openEditor(DiagramDialectUIServices.java:209)
	at org.eclipse.sirius.diagram.ui.business.internal.dialect.DiagramDialectUIServices.openEditor(DiagramDialectUIServices.java:171)
	at org.eclipse.sirius.ui.business.internal.dialect.DialectUIManagerImpl.openEditor(DialectUIManagerImpl.java:102)
	at org.eclipse.sirius.ui.tools.internal.actions.session.OpenRepresentationsAction.openRepresentations(OpenRepresentationsAction.java:122)
	at org.eclipse.sirius.ui.tools.internal.actions.session.OpenRepresentationsAction.access$1(OpenRepresentationsAction.java:101)
	at org.eclipse.sirius.ui.tools.internal.actions.session.OpenRepresentationsAction$1.run(OpenRepresentationsAction.java:84)
	at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:466)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:374)
	at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:527)
	at org.eclipse.ui.internal.progress.ProgressManager$RunnableWithStatus.run(ProgressManager.java:1380)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.internal.progress.ProgressManager$5.run(ProgressManager.java:1214)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:187)
	at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:156)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:4734)
	at org.eclipse.ui.internal.progress.ProgressManager.runInUI(ProgressManager.java:1211)
	at org.eclipse.sirius.ui.tools.internal.actions.session.OpenRepresentationsAction.run(OpenRepresentationsAction.java:87)
	at org.eclipse.sirius.ui.tools.internal.views.common.navigator.OpenRepresentationListener.doubleClick(OpenRepresentationListener.java:42)
	at org.eclipse.jface.viewers.StructuredViewer$1.run(StructuredViewer.java:831)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:50)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:178)
	at org.eclipse.jface.viewers.StructuredViewer.fireDoubleClick(StructuredViewer.java:828)
	at org.eclipse.jface.viewers.AbstractTreeViewer.handleDoubleSelect(AbstractTreeViewer.java:1472)
	at org.eclipse.ui.navigator.CommonViewer.handleDoubleSelect(CommonViewer.java:454)
	at org.eclipse.jface.viewers.StructuredViewer$4.widgetDefaultSelected(StructuredViewer.java:1237)
	at org.eclipse.jface.util.OpenStrategy.fireDefaultSelectionEvent(OpenStrategy.java:252)
	at org.eclipse.jface.util.OpenStrategy.access$0(OpenStrategy.java:249)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:311)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4353)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4172)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3761)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
	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:380)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
Comment 1 Maxime Porhel CLA 2014-12-04 11:07:17 EST
The code leading to this issue has been corrected in commit c6b7151a193e20ee63d48326a90f060c6d6edf87 : the Tree/TableToolVariables switch were setting twice the name of containerViewVariable instead of setting the name of containerViewVariabl and containerView. The issue existed during creation of a Table/Tree navigation tool in the VSM editor before Sirius 2.0.0 and cannot occur anymore with Sirius 2.x. 

Olivier only had to set a name to the ElementSelectVariable without name of its unique TableNavigationTool and he does not have the issue anymore. 

We could use this issue to provide a validation rule to detect any variable a null or empty name. 






Step to reproduce the initial issue: 
 . In a VSM with a Table description and a Diagram Description
 . With Sirius 1.0.x, create a Table Navigation Tool : its element select variable has no name
 . Create a diagram and a table
 . Close them
 . From the diagram, right click the mapping which has the navigation name, and navigate to the table
 . Close the diagram
 . Open the diagram from the model explorer 
 . NPE


Step to validate the real issue
 . Create a VSM with a lot of tools
 . Unset the name of the variables (in textual editor: remove the attribute or put "")
 . Launch the validate action
 . All variable without a name (= with a null name or an empty name) should appear in the reported problems.
Comment 2 Maxime Porhel CLA 2014-12-04 11:19:12 EST
Another or additonal solution could be to control the action of the user on property section and never set a null/empty name to a variable
Comment 3 Maxime Porhel CLA 2014-12-04 11:20:02 EST
*** Bug 453539 has been marked as a duplicate of this bug. ***
Comment 4 Jessy Mallet CLA 2014-12-22 10:24:18 EST
currently working on it
Comment 5 Jessy Mallet CLA 2015-01-06 11:27:09 EST
wating for review : 
https://git.eclipse.org/r/#/c/39055/
Comment 6 Esteban DUGUEPEROUX CLA 2015-01-21 05:10:19 EST
https://git.eclipse.org/r/#/c/39055/ as ce92cde3465243d37a98ecf87c26d708e3d70d01
Comment 7 Esteban DUGUEPEROUX CLA 2015-01-21 05:12:29 EST
Fixed.
Comment 8 Belqassim Djafer CLA 2015-04-09 11:51:49 EDT
Verified on Sirius 3.0.0M6
Comment 9 Pierre-Charles David CLA 2015-06-24 11:13:11 EDT
Available in Sirius 3.0.0. See https://wiki.eclipse.org/Sirius/3.0.0.
Comment 10 Eclipse Genie CLA 2016-05-03 04:15:27 EDT
New Gerrit change created: https://git.eclipse.org/r/71860