This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 395161 - Binding Context without name -> Error Message is misleading
Summary: Binding Context without name -> Error Message is misleading
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2.1   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 4.4 M4   Edit
Assignee: Lars Vogel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-27 08:02 EST by Levent Yildirim CLA
Modified: 2013-12-12 07:04 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Levent Yildirim CLA 2012-11-27 08:02:33 EST
!SESSION 2012-11-27 10:52:52.814 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_22
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
Framework arguments:  -product com.example.e4.rcp.todo.todo -clearPersistedState
Command-line arguments:  -product com.example.e4.rcp.todo.todo -data C:\Users\l.yildirim\schulung/../runtime-todo.product -dev file:C:/Users/l.yildirim/schulung/.metadata/.plugins/org.eclipse.pde.core/todo.product/dev.properties -os win32 -ws win32 -arch x86_64 -consoleLog -clearPersistedState

!ENTRY org.eclipse.e4.ui.workbench 4 0 2012-11-27 10:52:55.622
!MESSAGE Unable to create class 'org.eclipse.e4.ui.internal.workbench.addons.ContextProcessingAddon' from bundle '43'
!STACK 0
org.eclipse.e4.core.di.InjectionException: java.lang.NullPointerException: The name of a context cannot be null
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:859)
	at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:111)
	at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:319)
	at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:253)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:185)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:105)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:71)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:49)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:254)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:132)
	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:353)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
	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:629)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
Caused by: java.lang.NullPointerException: The name of a context cannot be null
	at org.eclipse.core.commands.contexts.Context.define(Context.java:140)
	at org.eclipse.e4.ui.internal.workbench.addons.ContextProcessingAddon.defineContexts(ContextProcessingAddon.java:65)
	at org.eclipse.e4.ui.internal.workbench.addons.ContextProcessingAddon.defineContexts(ContextProcessingAddon.java:69)
	at org.eclipse.e4.ui.internal.workbench.addons.ContextProcessingAddon.defineContexts(ContextProcessingAddon.java:54)
	at org.eclipse.e4.ui.internal.workbench.addons.ContextProcessingAddon.init(ContextProcessingAddon.java:47)
	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:56)
	... 23 more
Comment 1 Lars Vogel CLA 2012-11-27 08:06:33 EST
To add a little description:

org.eclipse.e4.core.di.InjectionException: java.lang.NullPointerException: The name of a context cannot be 

The bug is asking for a improved error message and context is a bit misleading. The error is actually thrown by a Binding Context which has no name in the application model.

So a better error message would be:

org.eclipse.e4.core.di.InjectionException: java.lang.NullPointerException: The name of a binding context cannot be null.
Comment 2 Paul Webster CLA 2012-11-28 08:43:16 EST
(In reply to comment #1)
> So a better error message would be:
> 
> org.eclipse.e4.core.di.InjectionException: java.lang.NullPointerException:
> The name of a binding context cannot be null.

The ContextProcessingAddon should either check for null or catch the NPE.  Then it should log the condition.


NPE wasn't really a good choice for that exception coming from the core Context object, it should have been something like IllegalArgumentException.

PW
Comment 3 Lars Vogel CLA 2013-11-18 09:07:21 EST
Proposed fix, error message will improve if Bug 421968 is also fixed.

https://git.eclipse.org/r/18501
Comment 5 Lars Vogel CLA 2013-12-12 07:04:38 EST
Verified in Build id: I20131211-2000 This makes my life as RCP trainer easier, if participants made an error in their keybinding definitions.