Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 368998 - [Compatibility] NPE when opening context menu in MAT's 'Compare Basket' view
Summary: [Compatibility] NPE when opening context menu in MAT's 'Compare Basket' view
Status: RESOLVED FIXED
Alias: None
Product: MAT
Classification: Tools
Component: GUI (show other bugs)
Version: 1.1   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-18 13:44 EST by Remy Suen CLA
Modified: 2012-01-20 05:33 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 Remy Suen CLA 2012-01-18 13:44:54 EST
java.lang.NullPointerException
	at org.eclipse.mat.ui.util.EasyToolBarDropDown.<init>(EasyToolBarDropDown.java:46)
	at org.eclipse.mat.ui.actions.QueryDropDownMenuAction.<init>(QueryDropDownMenuAction.java:53)
	at org.eclipse.mat.ui.compare.CompareBasketView$4.menuShown(CompareBasketView.java:272)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:247)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1058)
	at org.eclipse.swt.widgets.Control.WM_INITMENUPOPUP(Control.java:4881)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4557)
	at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
	at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1627)
	at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2069)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4972)
	at org.eclipse.swt.internal.win32.OS.TrackPopupMenu(Native Method)
	at org.eclipse.swt.widgets.Menu._setVisible(Menu.java:256)
	at org.eclipse.swt.widgets.Display.runPopups(Display.java:4206)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3748)
Comment 1 Remy Suen CLA 2012-01-18 13:53:26 EST
Actually, the same error occurs in 3.x.

java.lang.NullPointerException
	at org.eclipse.mat.ui.util.EasyToolBarDropDown.<init>(EasyToolBarDropDown.java:46)
	at org.eclipse.mat.ui.actions.QueryDropDownMenuAction.<init>(QueryDropDownMenuAction.java:53)
	at org.eclipse.mat.ui.compare.CompareBasketView$4.menuShown(CompareBasketView.java:272)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:247)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1058)
	at org.eclipse.swt.widgets.Control.WM_INITMENUPOPUP(Control.java:4881)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4557)
	at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
	at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1610)
	at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2061)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4972)
	at org.eclipse.swt.internal.win32.OS.TrackPopupMenu(Native Method)
	at org.eclipse.swt.widgets.Menu._setVisible(Menu.java:256)
	at org.eclipse.swt.widgets.Display.runPopups(Display.java:4206)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3748)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
Comment 2 Andrew Johnson CLA 2012-01-18 16:25:01 EST
Do you have a few more details about how to reproduce this - does it happen always, which exact version, which steps do you take?
Comment 3 Remy Suen CLA 2012-01-18 16:29:02 EST
(In reply to comment #2)
> Do you have a few more details about how to reproduce this - does it happen
> always, which exact version, which steps do you take?

Yes, it always happens. Just open the 'Compare Basket' view and then right-click on it and the error will occur.

I am using Memory Analyzer version 1.1.0.201105231821.
Comment 4 Andrew Johnson CLA 2012-01-20 03:35:32 EST
I've reproduced the problem - the right click is on the empty compare basket view, and the message appears in the error log (no pop-up error appears).

java.lang.NullPointerException
at org.eclipse.mat.ui.util.EasyToolBarDropDown.<init>(EasyToolBarDropDown.java:46)
at org.eclipse.mat.ui.actions.QueryDropDownMenuAction.<init>(QueryDropDownMenuAction.java:53)
at org.eclipse.mat.ui.compare.CompareBasketView$4.menuShown(CompareBasketView.java:272)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:241)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1058)
at org.eclipse.swt.widgets.Control.WM_INITMENUPOPUP(Control.java:4487)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:4190)
at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1598)
at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2038)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4873)
at org.eclipse.swt.internal.win32.OS.TrackPopupMenu(Native Method)
at org.eclipse.swt.widgets.Menu._setVisible(Menu.java:256)
at org.eclipse.swt.widgets.Display.runPopups(Display.java:4107)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3651)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.mat.ui.rcp.Application.start(Application.java:26)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)

There's also another problem. If I add a histogram to the basket, but don't select it, but right click on an empty space in the table, then do 'Compare Tables with all set operations' then I get:
java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0
at org.eclipse.mat.internal.snapshot.inspections.CompareTablesQuery.execute(CompareTablesQuery.java:106)
at org.eclipse.mat.query.registry.ArgumentSet.execute(ArgumentSet.java:129)
at org.eclipse.mat.ui.QueryExecution$ExecutionJob.run(QueryExecution.java:174)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 5 Andrew Johnson CLA 2012-01-20 05:33:14 EST
I have some fixes:
If there are no entries in the table then we shouldn't have a menu.
If there no selected entries in the table then queries which expect a table/tree should not be allowed.
Also the status message when selecting a query description on the menu didn't appear at the bottom as the IStatusLine should be obtained from the view site, not the editor.
This bug also appeared in the inspector view and notes view.