Bug 582663 - NPE at org.eclipse.e4.ui.workbench.addons.minmax.TrimStack.getFixedSides()
Summary: NPE at org.eclipse.e4.ui.workbench.addons.minmax.TrimStack.getFixedSides()
Status: NEW
Alias: None
Product: Incubator
Classification: Eclipse Project
Component: e4 (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: E4 Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-23 05:16 EST by Nikita Isalkar CLA
Modified: 2023-11-23 05:16 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nikita Isalkar CLA 2023-11-23 05:16:38 EST
Hi team, 

I am getting a NullPointerException at method org.eclipse.e4.ui.workbench.addons.minmax.TrimStack.getFixedSides(TrimStack.java:1180

Steps I have followed : 
1. Launch our Eclipse based application.
2. Click on minimize button for any view (for example, Project Explorer).
3. After minimizing this view, we get icons on either side of the window.
4. Click on View icon, after clicking on the icon I should be able to see the view, but instead I am getting NullPointerException in TrimStack.getFixedSides(method) and UI is behaving unusual.
 Furthermore, in some instances the icons are hidden, they only show up after I restart my application.

Please see : We have upgraded RCP from 4.6.3 to 4.15 and we are getting this issue after the upgrade. 

Stack trace
-----------------------
java.lang.NullPointerException
	at org.eclipse.e4.ui.workbench.addons.minmax.TrimStack.getFixedSides(TrimStack.java:1180)
	at org.eclipse.e4.ui.workbench.addons.minmax.TrimStack.getHostPane(TrimStack.java:1162)
	at org.eclipse.e4.ui.workbench.addons.minmax.TrimStack.showStack(TrimStack.java:950)
	at org.eclipse.e4.ui.workbench.addons.minmax.TrimStack$2.widgetSelected(TrimStack.java:516)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:252)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4105)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1037)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3922)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3524)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1160)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1049)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:658)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:557)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:154)
	at com.rocketsoftware.bi.ide.core.rcp.BiApplication.runApp(BiApplication.java:195)
	at com.rocketsoftware.bi.ide.core.rcp.BiApplication.start(BiApplication.java:81)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:657)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:594)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1447)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1420)



-------------------------------------------------------------------------------
I propose to add a null check after line 1179

Control trimCtrl = (Control) toolControl.getWidget();
     if(trimCtrl == null){
         return 0;
     }

This may resolve the issue