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

Bug 385267

Summary: Change exception message
Product: [Eclipse Project] Platform Reporter: Katharina Digeser <k.digeser>
Component: UIAssignee: Eric Moffatt <emoffatt>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Lars.Vogel, nobody, pwebster, pwebster
Version: 3.5Keywords: helpwanted
Target Milestone: 4.2.1   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
patch proposal. none

Description Katharina Digeser CLA 2012-07-17 04:27:43 EDT
Build Identifier: 

if the name of the Binding Context is empty, the Nullpointer Exception should be  "The name of a binding context cannot be null" instead of "The name of a scheme cannot be null"

org.eclipse.e4.core.di.InjectionException: java.lang.NullPointerException: The name of a scheme 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:857)
	at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:111)
	at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:318)
	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 scheme 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: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

Reproducible: Always

Steps to Reproduce:
1.Create Binding Context
2.let the Name label empty 
3.start application
Comment 1 Lars Vogel CLA 2012-07-19 02:51:48 EDT
@Paul, make sense to me to change the error message. What do you think?
Comment 2 Paul Webster CLA 2012-07-19 09:40:08 EDT
Yeah, that's a cut and paste error in org.eclipse.core.commands.contexts.Context.define(String, String, String)

patches welcome.

PW
Comment 3 Nobody - feel free to take it CLA 2012-07-19 09:56:31 EDT
This is minimal effort (patch this tonight) but when my patch on bug 379313 is reviewed (maybe applied) I can make a warning to tell people not to leave the name empty.

The patch in bug 379313 (if applied) makes it possible to warn for empty name, Id and description (this last one was not intended but doesn't hurt).
Comment 4 Lars Vogel CLA 2012-07-19 15:17:48 EDT
@Sopot, patch applied. Please open a new bug for the warning in the model editor. I think it is a great idea This bug is about the incorrect error message from the runtime.
Comment 5 Nobody - feel free to take it CLA 2012-07-19 17:31:46 EDT
Created attachment 218955 [details]
patch proposal.

Name fix.
@Katharina
Many thanks for taking the time to report this.
Comment 6 Nobody - feel free to take it CLA 2012-07-19 17:54:14 EDT
@Lars
Bug 385556 created and patched.
Comment 7 Eric Moffatt CLA 2012-08-14 11:11:00 EDT
commit 91fd715a147edbe1898baa54084ed04eceb80fd7

Ah, if only they were all this easy...;-).
Comment 8 Eric Moffatt CLA 2012-08-30 11:02:54 EDT
Verified (by code inspection) in M20120829-1200.