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

Bug 313430

Summary: [Workbench] NPE during startup at WorkbenchKeyboard.isPartialMatch
Product: [Eclipse Project] Platform Reporter: Chris Lee <eclipse>
Component: UIAssignee: Paul Webster <pwebster>
Status: VERIFIED FIXED QA Contact: Paul Webster <pwebster>
Severity: normal    
Priority: P3    
Version: 3.4   
Target Milestone: 3.7 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Close a gap none

Description Chris Lee CLA 2010-05-18 16:07:42 EDT
Build Identifier: M20080911-1700

It's possible to crash Eclipse during startup just by pressing keys while the splash screen is up.

It seems that this class (potentially others?) has no handling for the case when the workbench isn't initialized yet, and is returning null for the bindingService.

!SESSION 2010-05-18 13:00:07.804 -----------------------------------------------
eclipse.buildId=M20080911-1700
java.version=1.6.0_01
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Command-line arguments:  -os win32 -ws win32 -arch x86 -clean

!ENTRY org.eclipse.ui 4 0 2010-05-18 13:00:35.179
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.NullPointerException
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.isPartialMatch(WorkbenchKeyboard.java:656)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:817)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:882)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:571)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:512)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:127)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1184)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1002)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1027)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1012)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1040)
	at org.eclipse.swt.widgets.Shell.sendKeyEvent(Shell.java:1290)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1036)
	at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1352)
	at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3894)
	at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:341)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:3787)
	at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:337)
	at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1576)
	at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:1937)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4528)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2371)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3420)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2293)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
	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:386)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	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:549)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1236)

Reproducible: Always

Steps to Reproduce:
1. Start Eclipse, choose workspace if necessary
2. Start pressing buttons on the keyboard repeatedly (you only need to actually press it once at the right time, but it's easiest to reproduce by just pressing repeatedly)
3. Crashes - check workspace logs for the stack trace.
Comment 1 Chris Lee CLA 2010-05-18 16:08:46 EDT
This is also reproducible in RCP apps (which is how we discovered the issue).
Comment 2 Paul Webster CLA 2011-02-02 11:39:51 EST
Created attachment 188163 [details]
Close a gap

There is a small window in which the Display filter has been installed by the binding service itself has not been registered.

PW
Comment 3 Paul Webster CLA 2011-02-02 11:40:44 EST
Released to HEAD

Chris, feel free to try the patch (or an upcoming 3.7 nightly/integration build) and make sure this resolves the problem for you.

PW
Comment 4 Chris Lee CLA 2011-02-02 12:38:51 EST
Thanks Paul.  It'll likely be a while until I can verify this - I'll trust that if you could repro it before and can't repro it anymore then it's fixed.

Chris
Comment 5 Paul Webster CLA 2011-02-02 13:02:51 EST
(In reply to comment #4)
> Thanks Paul.  It'll likely be a while until I can verify this - I'll trust that
> if you could repro it before and can't repro it anymore then it's fixed.

I wasn't able to reproduce it, no matter how much I hammered on the keys during the splash screen :-)  This fix is based upon code analysis.

When you do get a chance, though, please just comment on the bug.

PW
Comment 6 Paul Webster CLA 2011-03-08 13:01:32 EST
verified fix is in the build: I20110307-2110
PW