Bug 20404 - [ExternalTools] NPE in External Tool Builders property page when missing builder
Summary: [ExternalTools] NPE in External Tool Builders property page when missing builder
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Ant (show other bugs)
Version: 2.0   Edit
Hardware: PC other
: P1 critical (vote)
Target Milestone: 2.0 F4   Edit
Assignee: Ryan Cooper CLA
QA Contact:
URL:
Whiteboard:
Keywords: ui
Depends on:
Blocks:
 
Reported: 2002-06-14 18:18 EDT by Unknown User CLA
Modified: 2005-01-18 16:44 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Unknown User CLA 2002-06-14 18:18:27 EDT
I selected a project and opened the properties dialog for it.
In the prop dialog, I selected the external builders page.  
Nothing happened.
So I selected another page, and then went back to the external builders page.
This time it appeared.
I closed the prop dialog.
Then I selected another project and invoked Properties.  
Nothing happened.
Here is what I found in my log ..

!MESSAGE Unhandled exception caught in event loop.
!ENTRY org.eclipse.ui 4 0 Jun 14, 2002 18:30:23.978
!MESSAGE java.lang.NullPointerException
!STACK 0
java.lang.NullPointerException
	at 
org.eclipse.ui.externaltools.internal.ui.BuilderPropertyPage.updateCommandItem
(BuilderPropertyPage.java:395)
	at 
org.eclipse.ui.externaltools.internal.ui.BuilderPropertyPage.addCommand
(BuilderPropertyPage.java:79)
	at 
org.eclipse.ui.externaltools.internal.ui.BuilderPropertyPage.addBuildersToTable
(BuilderPropertyPage.java:57)
	at 
org.eclipse.ui.externaltools.internal.ui.BuilderPropertyPage.createContents
(BuilderPropertyPage.java:203)
	at org.eclipse.jface.preference.PreferencePage.createControl
(PreferencePage.java:201)
	at org.eclipse.jface.preference.PreferenceDialog.showPage
(PreferenceDialog.java:919)
	at org.eclipse.jface.preference.PreferenceDialog.selectSavedItem
(PreferenceDialog.java:609)
	at org.eclipse.jface.preference.PreferenceDialog.createContents
(PreferenceDialog.java:270)
	at org.eclipse.jface.window.Window.create(Window.java:277)
	at org.eclipse.ui.dialogs.PropertyDialogAction.run
(PropertyDialogAction.java:156)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:749)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection
(ActionContributionItem.java:407)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent
(ActionContributionItem.java(Compiled Code))
	at 
org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent
(ActionContributionItem.java(Compiled Code))
	at 
org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent
(ActionContributionItem.java(Compiled Code))
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java
(Compiled Code))
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java(Compiled Code))
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java
(Compiled Code))
	at org.eclipse.swt.widgets.Menu.setVisible(Menu.java:920)
	at org.eclipse.swt.widgets.Control.WM_CONTEXTMENU(Control.java:2818)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java(Compiled 
Code))
	at org.eclipse.swt.widgets.Display.windowProc(Display.java(Compiled 
Code))
	at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
	at org.eclipse.swt.widgets.Tree.callWindowProc(Tree.java(Compiled Code))
	at org.eclipse.swt.widgets.Tree.callWindowProc(Tree.java(Compiled Code))
	at org.eclipse.swt.widgets.Control.WM_RBUTTONUP(Control.java:3707)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java(Compiled 
Code))
	at org.eclipse.swt.widgets.Display.windowProc(Display.java(Compiled 
Code))
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java(Compiled 
Code))
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java
(Compiled Code))
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java
(Compiled Code))
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:1160)
	at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:739)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462)
	at java.lang.reflect.Method.invoke(Native Method)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:248)
	at org.eclipse.core.launcher.Main.run(Main.java:697)
	at org.eclipse.core.launcher.Main.main(Main.java:530)
Comment 1 Nick Edgar CLA 2002-06-17 12:45:23 EDT
Please investigate whether this should be a candidate for F4.
Need value/risk assessment.
Comment 2 Simon Arsenault CLA 2002-06-17 13:12:44 EDT
Dave, what build are you using? What type of project did you open the 
properties on? In what view/perspective?
Comment 3 Ryan Cooper CLA 2002-06-17 13:40:45 EDT
Risk: low
Value: high

At BuilderPropertyPage line 395, we were calling IPluginRegistry.getExtension
(String, String, String), which can potentially return null, but we were not 
checking for null. The fix is to check for null as shown below. The message 
which appears hard-coded below if null is returned should be stored in 
messages.properties for the real fix.

// Get the human-readable name of the builder
IExtension extension = Platform.getPluginRegistry().getExtension
(ResourcesPlugin.PI_RESOURCES, 	ResourcesPlugin.PT_BUILDERS, builderID);
String builderName;
if (extension != null)
	builderName = extension.getLabel();
else
	builderName = "Could not find builder with id " + builderID;
item.setText(builderName);
item.setImage(builderImage);
Comment 4 Nick Edgar CLA 2002-06-17 16:05:56 EDT
Please use "Missing builder (id={0})" instead.

Comment 5 Simon Arsenault CLA 2002-06-19 15:10:28 EDT
Ryan did the necessary code changes in BuilderPropertyPage and messages file.

Checked by Tod and Simon