Bug 517999 - NPE when renaming a plugin containing an odesign that is opened in VSM editor
Summary: NPE when renaming a plugin containing an odesign that is opened in VSM editor
Status: CLOSED FIXED
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: 5.0.0   Edit
Hardware: All All
: P3 minor (vote)
Target Milestone: 6.4.2   Edit
Assignee: Lakshminarayana CLA
QA Contact:
URL:
Whiteboard: vsm
Keywords: helpwanted, triaged
: 484195 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-06-08 08:46 EDT by Pierre Guilet CLA
Modified: 2021-06-06 12:59 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pierre Guilet CLA 2017-06-08 08:46:28 EDT
Step to reproduce:
- Create a viewpoint specification projet
- Open its odseign with VSM editor
- Rename the project 
You have the NPE:

java.lang.NullPointerException
	at org.eclipse.ui.part.MultiPageEditorPart.deactivateSite(MultiPageEditorPart.java:922)
	at org.eclipse.ui.part.MultiPageEditorPart.dispose(MultiPageEditorPart.java:499)
	at org.eclipse.sirius.editor.editorPlugin.SiriusEditor.dispose(SiriusEditor.java:1371)
	at org.eclipse.sirius.editor.tools.internal.presentation.CustomSiriusEditor.dispose(CustomSiriusEditor.java:495)
	at org.eclipse.sirius.editor.editorPlugin.SiriusEditor$3$1.run(SiriusEditor.java:422)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:37)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:182)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4213)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3820)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.block(ModalContext.java:165)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:369)
	at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.run(RefactoringWizardDialog2.java:321)
	at org.eclipse.ltk.ui.refactoring.RefactoringWizard.internalPerformFinish(RefactoringWizard.java:636)
	at org.eclipse.ltk.ui.refactoring.UserInputWizardPage.performFinish(UserInputWizardPage.java:145)
	at org.eclipse.jdt.internal.ui.refactoring.reorg.DeleteWizard$DeleteInputPage.performFinish(DeleteWizard.java:173)
	at org.eclipse.ltk.ui.refactoring.RefactoringWizard.performFinish(RefactoringWizard.java:710)
	at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.okPressed(RefactoringWizardDialog2.java:447)
	at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:466)
	at org.eclipse.jface.dialogs.Dialog.lambda$0(Dialog.java:619)
	at org.eclipse.swt.events.SelectionListener$1.widgetSelected(SelectionListener.java:81)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:249)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4428)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4238)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3817)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:818)
	at org.eclipse.jface.window.Window.open(Window.java:794)
	at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation$1.run(RefactoringWizardOpenOperation.java:188)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.run(RefactoringWizardOpenOperation.java:203)
	at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.run(RefactoringWizardOpenOperation.java:122)
	at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate(RefactoringStarter.java:38)
	at org.eclipse.jdt.internal.ui.refactoring.UserInterfaceStarter.activate(UserInterfaceStarter.java:62)
	at org.eclipse.jdt.internal.corext.refactoring.RefactoringExecutionStarter.startDeleteRefactoring(RefactoringExecutionStarter.java:284)
	at org.eclipse.jdt.internal.ui.refactoring.reorg.DeleteAction.run(DeleteAction.java:202)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:271)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:249)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:473)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:565)
	at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:397)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4428)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4238)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3817)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1044)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:680)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)
	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:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	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:653)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
Comment 1 Pierre-Charles David CLA 2017-06-16 09:04:30 EDT
Confirmed, thanks for the report. Actually, this was fixed in EMF's generators in bug #235797 in... 2008. Except that the SiriusEditor was generated once a long time ago, before that, and we never refreshed the generated code.
Comment 2 Eclipse Genie CLA 2020-12-04 22:48:56 EST
New Gerrit change created: https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/173430
Comment 3 Lakshminarayana CLA 2020-12-04 23:00:53 EST
(In reply to Eclipse Genie from comment #2)
> New Gerrit change created:
> https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/173430

SiriusEditor.dispose() being called twice. So, the code is trying to deactivating services that were already deactivated. 

The new EMF code generator not generating the additional dispose call.

dispose method is alreday being called on the close editor.
See "org.eclipse.ui.internal.e4.compatibility.CompatibilityPart" for more details

		if (wrapped != null) {
			try {
				wrapped.dispose();
			} catch (Exception e) {
				// client code may have errors so we need to catch it
				logger.error(e);
			}
			wrapped = null;
		}
Comment 5 Glenn Plouhinec CLA 2021-03-04 08:48:18 EST
Validated with Sirius 6.4.2.
Comment 6 Pierre-Charles David CLA 2021-03-18 04:44:19 EDT
Available in Sirius 6.4.2: http://download.eclipse.org/sirius/updates/releases/6.4.2
Comment 7 Pierre-Charles David CLA 2021-06-06 12:59:22 EDT
*** Bug 484195 has been marked as a duplicate of this bug. ***