eclipse-ocl / org.eclipse.ocl

Eclipse Public License 2.0
0 stars 0 forks source link

[ui] NPE in OCL->Validate #1698

Open eclipse-ocl-bot opened 1 month ago

eclipse-ocl-bot commented 1 month ago

| --- | --- | | Bugzilla Link | 493322 | | Status | NEW | | Importance | P3 normal | | Reported | May 10, 2016 07:55 EDT | | Modified | May 10, 2016 08:50 EDT | | Reporter | Ed Willink |

Description

If OCL->Validate is invoked in an editor for which ValidateCommand.setActiveWorkbenchPart fails to locate an EditingDomain, any previous domain is used.

If null, an NPE may result, if selectedObjects which may also ne null does not barf first.

If non-null it may be an inappropriate editing domain.

--

ValidateCommand.setActiveWorkbenchPart works hard to find an EditingDomain. ? has the getAdapter() functionality of Xtext editors changed ?

eclipse-ocl-bot commented 1 month ago

By Ed Willink on May 10, 2016 08:43

Repro:

Start Eclipse.\ Open an Ecore file in OCLinECore editor.\ OCL->Validate

=>

java.lang.reflect.InvocationTargetException\ at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:398)\ at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:481)\ at org.eclipse.emf.edit.ui.action.ValidateAction.run(ValidateAction.java:187)\ at org.eclipse.ocl.xtext.base.ui.commands.ValidateHandler.execute(ValidateHandler.java:182)\ at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:295)\ at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:90)\ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\ at java.lang.reflect.Method.invoke(Method.java:498)\ at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:54)\ at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:282)\ at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:264)\ at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)\ at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:152)\ at org.eclipse.core.commands.Command.executeWithChecks(Command.java:494)\ at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:488)\ at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:210)\ at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:427)\ at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.handleWidgetSelection(AbstractContributionItem.java:454)\ at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem$3.handleEvent(AbstractContributionItem.java:482)\ at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)\ at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4415)\ at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079)\ at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4233)\ at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3821)\ at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1119)\ at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)\ at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1020)\ at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150)\ at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:687)\ at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)\ at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:604)\ at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)\ at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)\ 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(NativeMethodAccessorImpl.java:62)\ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\ at java.lang.reflect.Method.invoke(Method.java:498)\ at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)\ at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)\ at org.eclipse.equinox.launcher.Main.run(Main.java:1519)\ at org.eclipse.equinox.launcher.Main.main(Main.java:1492)\ Caused by: java.lang.NullPointerException\ at org.eclipse.emf.edit.ui.action.ValidateAction.validate(ValidateAction.java:227)\ at org.eclipse.emf.edit.ui.action.ValidateAction$1.run(ValidateAction.java:176)\ at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)\ Root exception:\ java.lang.NullPointerException\ at org.eclipse.emf.edit.ui.action.ValidateAction.validate(ValidateAction.java:227)\ at org.eclipse.emf.edit.ui.action.ValidateAction$1.run(ValidateAction.java:176)\ at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)

eclipse-ocl-bot commented 1 month ago

By Ed Willink on May 10, 2016 08:50

(In reply to Ed Willink from comment #0)

ValidateCommand.setActiveWorkbenchPart works hard to find an EditingDomain. ? has the getAdapter() functionality of Xtext editors changed ?

No OCL->validate in Luna so not that longstanding a chnage.

Same error occurs in Mars.

Looks as if the effort was for foreign editors and OCL-in-OCL was overlooked.