Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 350390 - [Compatibility] NPE with GEF editor
Summary: [Compatibility] NPE with GEF editor
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.1   Edit
Hardware: All All
: P3 blocker (vote)
Target Milestone: 4.2 M1   Edit
Assignee: Remy Suen CLA
QA Contact: Remy Suen CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 350459
  Show dependency tree
 
Reported: 2011-06-26 21:04 EDT by Yves YANG CLA
Modified: 2011-08-26 11:53 EDT (History)
0 users

See Also:


Attachments
MenuHelper patch v1 (1.53 KB, patch)
2011-06-27 11:14 EDT, Remy Suen CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yves YANG CLA 2011-06-26 21:04:48 EDT
I met a NPE exception with GEF using eclipse-SDK-4.1-Win32:

java.lang.NullPointerException
	at org.eclipse.ui.internal.commands.CommandImageManager.getImageDescriptor(CommandImageManager.java:274)
	at org.eclipse.ui.internal.commands.CommandImageManager.getImageDescriptor(CommandImageManager.java:237)
	at org.eclipse.ui.internal.commands.CommandImageService.getImageDescriptor(CommandImageService.java:125)
	at org.eclipse.ui.internal.menus.MenuHelper.getIconURI(MenuHelper.java:898)
	at org.eclipse.ui.internal.menus.MenuHelper.createToolItem(MenuHelper.java:723)
	at org.eclipse.ui.internal.CoolBarToTrimManager.fill(CoolBarToTrimManager.java:638)
	at org.eclipse.ui.internal.CoolBarToTrimManager.update(CoolBarToTrimManager.java:584)
	at org.eclipse.ui.internal.WorkbenchWindow.updateActionBars(WorkbenchWindow.java:1643)
	at org.eclipse.ui.internal.WWinActionBars.updateActionBars(WWinActionBars.java:113)
	at org.eclipse.ui.SubActionBars.updateActionBars(SubActionBars.java:611)
	at org.eclipse.ui.internal.e4.compatibility.ActionBars.updateActionBars(ActionBars.java:96)
	at org.eclipse.ui.part.PageBookView.showPageRec(PageBookView.java:1015)
	at org.eclipse.ui.part.PageBookView.createPartControl(PageBookView.java:490)
	at org.eclipse.ui.views.properties.PropertySheet.createPartControl(PropertySheet.java:157)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.createPartControl(CompatibilityPart.java:122)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityView.createPartControl(CompatibilityView.java:93)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:256)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)


It seems the error is in the class org.eclipse.ui.internal.menus.MenuHelper at the line 723, 

			MDirectToolItem toolItem = MenuFactoryImpl.eINSTANCE.createDirectToolItem();
			String itemId = item.getId();
			toolItem.setElementId(itemId == null ? id : itemId);
			String iconURI = getIconURI(action.getImageDescriptor());
			if (iconURI == null) {
				iconURI = getIconURI(id, application.getContext());

The call of the last line above id is null. It should be the value of "itemId".
Comment 1 Remy Suen CLA 2011-06-27 11:14:06 EDT
Created attachment 198658 [details]
MenuHelper patch v1

Correct the passing of the bad parameter and also added extra code to return early if another code path elsewhere tries to do the same thing.
Comment 2 Remy Suen CLA 2011-06-27 11:19:24 EDT
(In reply to comment #1)
> Created attachment 198658 [details]
> MenuHelper patch v1

Patch released to CVS HEAD, thank you very much for the bug report, Yves!
Comment 3 Yves YANG CLA 2011-06-27 11:23:43 EDT
(In reply to comment #2)
> (In reply to comment #1)
> > Created attachment 198658 [details] [details]
> > MenuHelper patch v1
> 
> Patch released to CVS HEAD, thank you very much for the bug report, Yves!

You are welcome.
Comment 4 Yves YANG CLA 2011-06-27 12:05:19 EDT
It seems the icons of alignment are missing in my environment. Have you observed the same?
Comment 5 Remy Suen CLA 2011-06-27 12:55:04 EDT
(In reply to comment #4)
> It seems the icons of alignment are missing in my environment. Have you
> observed the same?

If you mean the editor's icons have been replaced by text, then yes, I am seeing this. This is a separate bug.
Comment 6 Remy Suen CLA 2011-08-26 11:53:25 EDT
Verified with M20110817-2001 on Windows XP.