Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 340508 - NPE in BindingCopies.isUserBinding
Summary: NPE in BindingCopies.isUserBinding
Status: RESOLVED FIXED
Alias: None
Product: e4
Classification: Eclipse Project
Component: UI (show other bugs)
Version: unspecified   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 4.1 M7   Edit
Assignee: Paul Webster CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-20 11:02 EDT by Thomas Schindl CLA
Modified: 2011-03-21 10:47 EDT (History)
3 users (show)

See Also:


Attachments
Avoid the init call v01 (2.70 KB, patch)
2011-03-20 22:46 EDT, Paul Webster CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Schindl CLA 2011-03-20 11:02:22 EDT
We are not properly intializing the BindingSystem in a pure e4 application:

org.eclipse.e4.core.di.InjectionException: java.lang.NullPointerException
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:828)
	at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:108)
	at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:310)
	at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:237)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:153)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:90)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:64)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:53)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:231)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:120)
	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:344)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Caused by: java.lang.NullPointerException
	at org.eclipse.e4.ui.bindings.internal.BindingCopies.isUserBinding(BindingCopies.java:64)
	at org.eclipse.e4.ui.workbench.swt.util.BindingProcessingAddon.createBinding(BindingProcessingAddon.java:247)
	at org.eclipse.e4.ui.workbench.swt.util.BindingProcessingAddon.defineBinding(BindingProcessingAddon.java:212)
	at org.eclipse.e4.ui.workbench.swt.util.BindingProcessingAddon.defineBindingTable(BindingProcessingAddon.java:202)
	at org.eclipse.e4.ui.workbench.swt.util.BindingProcessingAddon.defineBindingTables(BindingProcessingAddon.java:185)
	at org.eclipse.e4.ui.workbench.swt.util.BindingProcessingAddon.init(BindingProcessingAddon.java:86)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
	... 23 more
Comment 1 Thomas Schindl CLA 2011-03-20 17:23:42 EDT
... and because we are at it. This class is violating one of the highest design principles we've defined: Singleons and statics are evil!

If there should be only one of this BindingCopies in a running instance I think we should push the thing into the IEclipseContext from the MApplication but we need to get rid of those statics!
Comment 2 Paul Webster CLA 2011-03-20 17:37:58 EDT
Tom, this was a temporary class to get Keys preference page started.

Jesse, I'll try and look at your patch tonight, but we have to get this bug fixed asap ... Please remove the init() calls from within head, and replace them with something like:

list getUserBindings() {
  if (userBindings==null) {
    userBindings = new list;
  }
  return userBindings;
}

PW
Comment 3 Paul Webster CLA 2011-03-20 22:46:07 EDT
Created attachment 191591 [details]
Avoid the init call v01
Comment 4 Paul Webster CLA 2011-03-20 22:47:02 EDT
Released to HEAD
Comment 5 Thomas Schindl CLA 2011-03-21 00:27:38 EDT
Paul, is there a defect to remove this class completely or to get rid of the statics in it?
Comment 6 Paul Webster CLA 2011-03-21 08:45:43 EDT
To remove it completely: bug 335985

PW
Comment 7 Jesse CLA 2011-03-21 10:47:01 EDT
BindingCopies was temporary...and yes I know, it's a VERY bad design decision. It's been completely removed in https://bugs.eclipse.org/bugs/show_bug.cgi?id=335985 but as it stands right now, only the default scheme will work.