Bug 535811 - [NPE] Show In -> Project Explorer in text editor
Summary: [NPE] Show In -> Project Explorer in text editor
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.8   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: 4.9 M2   Edit
Assignee: Andrey Loskutov CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks: 505817
  Show dependency tree
 
Reported: 2018-06-12 09:12 EDT by Dawid Pakula CLA
Modified: 2018-06-18 11:59 EDT (History)
3 users (show)

See Also:


Attachments
Cannot reproduce anim gif (501.71 KB, image/gif)
2018-06-12 16:41 EDT, Patrik Suzzi CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dawid Pakula CLA 2018-06-12 09:12:12 EDT
Steps to reproduce. Create TXT file in any project. Right click in editor -> Show In -> Project Explorer.

Stack:

!ENTRY org.eclipse.ui 4 0 2018-06-12 15:08:00.136
!MESSAGE Unhandled event loop exception
!STACK 0
org.eclipse.e4.core.di.InjectionException: java.lang.NullPointerException
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:65)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:318)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:252)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:161)
	at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:152)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:494)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:487)
	at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:204)
	at org.eclipse.ui.internal.handlers.LegacyHandlerService.executeCommand(LegacyHandlerService.java:393)
	at org.eclipse.ui.menus.CommandContributionItem.handleWidgetSelection(CommandContributionItem.java:820)
	at org.eclipse.ui.menus.CommandContributionItem.lambda$3(CommandContributionItem.java:797)
	at org.eclipse.ui.menus.CommandContributionItem$$Lambda$434/681674468.handleEvent(Unknown Source)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4247)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1508)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1531)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1516)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1320)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4091)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3712)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1170)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1059)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:683)
	at org.eclipse.ui.internal.Workbench$$Lambda$24/655304911.run(Unknown Source)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:597)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:656)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:592)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1498)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1471)
Caused by: java.lang.NullPointerException
	at org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:1297)
	at org.eclipse.ui.internal.WorkbenchPage$12.run(WorkbenchPage.java:4374)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:71)
	at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:4370)
	at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:4350)
	at org.eclipse.ui.internal.ShowInHandler.execute(ShowInHandler.java:79)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:291)
	at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:93)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55)
	... 42 more
Comment 1 Patrik Suzzi CLA 2018-06-12 16:41:38 EDT
Created attachment 274444 [details]
Cannot reproduce anim gif

Can not reproduce with the given steps: 
Create TXT file in any project. Right-click in editor -> Show In -> Project Explorer.


Tested with latest I-build: 

Eclipse SDK
Version: Photon (4.8)
Build id: I20180611-0500
OS: Mac OS X, v.10.13.3, x86_64 / cocoa
Comment 2 Dawid Pakula CLA 2018-06-12 18:50:41 EDT
wow, looks like my two fresh photon workspaces are broken. On third works fine :/

After remove ./org.eclipse.e4.workbench/workbench.xmi no NPE i see. Also list of  perspectives is correct.

Is there any way to prevent such situations in future? Or always where something looks bad I have to reset UI file manually?
Comment 3 Patrik Suzzi CLA 2018-06-13 03:11:21 EDT
Closing as worksforme.

I can’t really help with the workbench.xmi. Generally, I believe this depends on plugins installed. If you see a frequent error, I suggest 1. Understand which plugin is causing this, 2. Reopen this bug, attach the xmi and tell which plugins you believe are responsible.
Comment 4 Andrey Loskutov CLA 2018-06-13 09:35:35 EDT
(In reply to Patrik Suzzi from comment #3)
> Closing as worksforme.

Why? If we can't reproduce it does not mean, but does not exist.

(In reply to Dawid Pakula from comment #2)
> wow, looks like my two fresh photon workspaces are broken. On third works
> fine :/
> 
> After remove ./org.eclipse.e4.workbench/workbench.xmi no NPE i see. Also
> list of  perspectives is correct.
> 
> Is there any way to prevent such situations in future? Or always where
> something looks bad I have to reset UI file manually?

I wonder how you've get the broken state. If you could go inside you and ask: what was different in those two broken workspaces, may be we would be able to get steps to reproduce. Think about specific perspectives/multi-window setups, detached views etc.

I will push a NPE guard which will convert the NPE to PartInitException. It will not fix anything, but at least we will get dedicated "Failed to show in" errors instead of " Unhandled event loop exception".
Comment 5 Eclipse Genie CLA 2018-06-13 09:39:28 EDT
New Gerrit change created: https://git.eclipse.org/r/124464
Comment 7 Andrey Loskutov CLA 2018-06-14 17:44:19 EDT
(In reply to Eclipse Genie from comment #6)
> Gerrit change https://git.eclipse.org/r/124464 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/
> ?id=bca7a5d8b76cb8916cc51bc1060ee4589712a03a

NPE should be replaced by PartInitException, so formally this is fixed now. Waiting for steps to reproduce or new bug reports with updated stack to fix the root cause.