Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » InjectionException caused by null argument
InjectionException caused by null argument [message #1185911] Thu, 14 November 2013 10:49 Go to next message
Ludwig Moser is currently offline Ludwig MoserFriend
Messages: 476
Registered: July 2009
Senior Member
Hello,

I'm using some code from vogella.com which uses an handler to switch perspectives.
i modified the handler and added an parameter (also added this parameter in extensions)
NOTE: i am using an E3 app in Eclipse 4!

public class SwitchPerspectiveHandler {
	@Execute
	public void execute(MApplication app, EPartService partService,
			EModelService modelService,
			@Named("perspectiveID") String perspectiveID) {
		// proof!
		System.out.println("app = "+app);
		System.out.println("partService = "+partService);
		System.out.println("modelService = "+modelService);
		System.out.println("perspectiveID = "+perspectiveID);
		
		
		MPerspective element = (MPerspective) modelService.find(perspectiveID,
				app);
		// now switch perspective
		partService.switchPerspective(element);
	}
}


i cannot reproduce the null argument. probably i do miss something basical. but my other handlers work fine this way (calling the handler with parameters)

and finally the resulting log with exception:
commandService=org.eclipse.e4.core.commands.internal.CommandServiceImpl@1f722f1
handlerService=org.eclipse.e4.core.commands.internal.HandlerServiceImpl@21bdb8
handlerId=SwitchPerspectiveHandler
myCommand=ParameterizedCommand(Command(SwitchPerspectiveHandler,SwitchPerspectiveHandler,
		,
		Category(org.eclipse.core.commands.categories.autogenerated,Uncategorized,Commands that were either auto-generated or have no category,true),
		org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@1899ef7,
		[Lorg.eclipse.e4.ui.internal.workbench.Parameter;@236aea,,true),[Lorg.eclipse.core.commands.Parameterization;@1406330)
params={perspectiveID=at.biooffice.views.contact.Perspective}
app = org.eclipse.e4.ui.model.application.impl.ApplicationImpl@125b707 (elementId: org.eclipse.e4.legacy.ide.application, tags: [activeSchemeId:org.eclipse.ui.defaultAcceleratorConfiguration], contributorURI: platform:/plugin/org.eclipse.ui.workbench) (widget: null, renderer: null, toBeRendered: true, onTop: false, visible: true, containerData: null, accessibilityPhrase: null) (context: WorkbenchContext, variables: null)
partService = org.eclipse.e4.ui.internal.workbench.PartServiceImpl@ac8605
modelService = org.eclipse.e4.ui.internal.workbench.ModelServiceImpl@9dffc4
perspectiveID = at.biooffice.views.contact.Perspective

!ENTRY org.eclipse.ui 4 0 2013-11-14 11:31:24.218
!MESSAGE Unhandled event loop exception
!STACK 0
org.eclipse.e4.core.di.InjectionException: org.eclipse.e4.core.di.InjectionException: org.eclipse.e4.core.di.InjectionException: org.eclipse.core.runtime.AssertionFailedException: null argument:
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:243)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:224)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
	at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:167)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:499)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
	at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
	at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:850)
	at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.handleWidgetSelection(HandledContributionItem.java:743)
	at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.access$7(HandledContributionItem.java:727)
	at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem$4.handleEvent(HandledContributionItem.java:662)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at at.biooffice.application.Application.start(Application.java:46)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
	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:636)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
Caused by: org.eclipse.e4.core.di.InjectionException: org.eclipse.e4.core.di.InjectionException: org.eclipse.core.runtime.AssertionFailedException: null argument:
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:243)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:224)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
	at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:167)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:499)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
	at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
	at lumo.core.util.HandlerMan.execute(HandlerMan.java:31)
	at lumo.core.util.SwitchPerspective.to(SwitchPerspective.java:45)

[Updated on: Thu, 14 November 2013 10:50]

Report message to a moderator

Re: InjectionException caused by null argument [message #1194963 is a reply to message #1185911] Mon, 18 November 2013 19:46 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Hi,

what is the meaning of the @Named("perspectiveID") parameter?
regards

Jonas

Am 14.11.2013 11:49, schrieb Ludwig Moser:
> Hello,
>
> I'm using some code from
> http://www.vogella.com/articles/Eclipse4Services/article.html#selectedservices_partservice4
> which uses an handler to switch perspectives.
> i modified the handler and added an parameter (also added this parameter
> in extensions)
> NOTE: i am using an E3 app in Eclipse 4!
>
> public class SwitchPerspectiveHandler {
> @Execute
> public void execute(MApplication app, EPartService partService,
> EModelService modelService,
> @Named("perspectiveID") String perspectiveID) {
> // proof!
> System.out.println("app = "+app);
> System.out.println("partService = "+partService);
> System.out.println("modelService = "+modelService);
> System.out.println("perspectiveID = "+perspectiveID);
>
>
> MPerspective element = (MPerspective)
> modelService.find(perspectiveID,
> app);
> // now switch perspective
> partService.switchPerspective(element);
> }
> }
>
> i cannot reproduce the null argument. probably i do miss something
> basical. but my other handlers work fine this way (calling the handler
> with parameters)
>
> and finally the resulting log with exception:
> commandService=org.eclipse.e4.core.commands.internal.CommandServiceImpl@1f722f1
>
> handlerService=org.eclipse.e4.core.commands.internal.HandlerServiceImpl@21bdb8
>
> handlerId=SwitchPerspectiveHandler
> myCommand=ParameterizedCommand(Command(SwitchPerspectiveHandler,SwitchPerspectiveHandler,
>
> ,
>
> Category(org.eclipse.core.commands.categories.autogenerated,Uncategorized,Commands
> that were either auto-generated or have no category,true),
> org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@1899ef7,
>
> [Lorg.eclipse.e4.ui.internal.workbench.Parameter;@236aea,,true),[Lorg.eclipse.core.commands.Parameterization;@1406330)
>
> params={perspectiveID=at.biooffice.views.contact.Perspective}
> app = org.eclipse.e4.ui.model.application.impl.ApplicationImpl@125b707
> (elementId: org.eclipse.e4.legacy.ide.application, tags:
> [activeSchemeId:org.eclipse.ui.defaultAcceleratorConfiguration],
> contributorURI: platform:/plugin/org.eclipse.ui.workbench) (widget:
> null, renderer: null, toBeRendered: true, onTop: false, visible: true,
> containerData: null, accessibilityPhrase: null) (context:
> WorkbenchContext, variables: null)
> partService = org.eclipse.e4.ui.internal.workbench.PartServiceImpl@ac8605
> modelService = org.eclipse.e4.ui.internal.workbench.ModelServiceImpl@9dffc4
> perspectiveID = at.biooffice.views.contact.Perspective
>
> !ENTRY org.eclipse.ui 4 0 2013-11-14 11:31:24.218
> !MESSAGE Unhandled event loop exception
> !STACK 0
> org.eclipse.e4.core.di.InjectionException:
> org.eclipse.e4.core.di.InjectionException:
> org.eclipse.e4.core.di.InjectionException:
> org.eclipse.core.runtime.AssertionFailedException: null argument:
> at
> org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63)
>
> at
> org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:243)
>
> at
> org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:224)
> at
> org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
>
> at
> org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:167)
>
> at
> org.eclipse.core.commands.Command.executeWithChecks(Command.java:499)
> at
> org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
>
> at
> org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
>
> at
> org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:850)
>
> at
> org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.handleWidgetSelection(HandledContributionItem.java:743)
>
> at
> org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.access$7(HandledContributionItem.java:727)
>
> at
> org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem$4.handleEvent(HandledContributionItem.java:662)
>
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
>
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
>
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
>
> at
> org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
>
> at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
>
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
> at at.biooffice.application.Application.start(Application.java:46)
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
>
> 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:636)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
> Caused by: org.eclipse.e4.core.di.InjectionException:
> org.eclipse.e4.core.di.InjectionException:
> org.eclipse.core.runtime.AssertionFailedException: null argument:
> at
> org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63)
>
> at
> org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:243)
>
> at
> org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:224)
> at
> org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
>
> at
> org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:167)
>
> at
> org.eclipse.core.commands.Command.executeWithChecks(Command.java:499)
> at
> org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
>
> at
> org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
>
> at lumo.core.util.HandlerMan.execute(HandlerMan.java:31)
> at lumo.core.util.SwitchPerspective.to(SwitchPerspective.java:45)
Re: InjectionException caused by null argument [message #1198065 is a reply to message #1194963] Wed, 20 November 2013 06:11 Go to previous message
Ludwig Moser is currently offline Ludwig MoserFriend
Messages: 476
Registered: July 2009
Senior Member
Jonas Helming wrote on Mon, 18 November 2013 14:46

what is the meaning of the @Named("perspectiveID") parameter?


the id of the perspective you want to switch to, as String.
Previous Topic:DirectMenuItem and their IDs in a handler class
Next Topic:how to initialize image registry in pure Eclipse 4
Goto Forum:
  


Current Time: Wed Sep 25 09:25:24 GMT 2024

Powered by FUDForum. Page generated in 0.02888 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top