Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 266711 - [target] Making a target's name empty causes NPE
Summary: [target] Making a target's name empty causes NPE
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.5 M6   Edit
Assignee: Ankur Sharma CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-02 11:29 EST by Curtis Windatt CLA
Modified: 2009-03-03 15:42 EST (History)
0 users

See Also:


Attachments
Full Patch (64.06 KB, patch)
2009-03-03 14:41 EST, Ankur Sharma CLA
curtis.windatt.public: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Curtis Windatt CLA 2009-03-02 11:29:04 EST
If you set a target's name to be an empty string in the wizard or editor you get NPEs.  We should avoid the NPEs, but also add validation preventing an empty name (which couldn't be shown properly on the preference page).

Note that there are other fields that can be set to random values and there is no validation for them.
Comment 1 Curtis Windatt CLA 2009-03-02 11:30:25 EST
If you have the time Ankur, I'd appreciate the name validation and NPE being fixed.

Here is the stack trace...

eclipse.buildId=I20090224-0800
java.version=1.6.0_07
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_CA
Framework arguments:  -product org.eclipse.sdk.ide
Command-line arguments:  -product org.eclipse.sdk.ide -data /home/cwindatt/Curtis/Workspace Target -dev file:/home/cwindatt/Curtis/Workspace/.metadata/.plugins/org.eclipse.pde.core/Target/dev.properties -os linux -ws gtk -arch x86


Error
Mon Mar 02 10:26:50 CST 2009
java.lang.NullPointerException

java.lang.NullPointerException
	at java.lang.String$CaseInsensitiveComparator.compare(String.java:1218)
	at java.lang.String$CaseInsensitiveComparator.compare(String.java:1212)
	at java.lang.String.compareToIgnoreCase(String.java:1259)
	at org.eclipse.pde.internal.ui.preferences.TargetPlatformPreferencePage2$5.compare(TargetPlatformPreferencePage2.java:194)
	at org.eclipse.jface.viewers.ViewerComparator$1.compare(ViewerComparator.java:187)
	at java.util.Arrays.mergeSort(Arrays.java:1270)
	at java.util.Arrays.sort(Arrays.java:1210)
	at org.eclipse.jface.viewers.ViewerComparator.sort(ViewerComparator.java:185)
	at org.eclipse.jface.viewers.StructuredViewer.getSortedChildren(StructuredViewer.java:1007)
	at org.eclipse.jface.viewers.AbstractTableViewer.internalRefreshAll(AbstractTableViewer.java:695)
	at org.eclipse.jface.viewers.AbstractTableViewer.internalRefresh(AbstractTableViewer.java:643)
	at org.eclipse.jface.viewers.StructuredViewer$8.run(StructuredViewer.java:1473)
	at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1381)
	at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1340)
	at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:1471)
	at org.eclipse.jface.viewers.ColumnViewer.refresh(ColumnViewer.java:548)
	at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:1428)
	at org.eclipse.pde.internal.ui.preferences.TargetPlatformPreferencePage2.performOk(TargetPlatformPreferencePage2.java:566)
	at org.eclipse.jface.preference.PreferenceDialog$13.run(PreferenceDialog.java:937)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.core.runtime.Platform.run(Platform.java:888)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
	at org.eclipse.jface.preference.PreferenceDialog.okPressed(PreferenceDialog.java:917)
	at org.eclipse.ui.internal.dialogs.FilteredPreferenceDialog.okPressed(FilteredPreferenceDialog.java:434)
	at org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog.okPressed(WorkbenchPreferenceDialog.java:164)
	at org.eclipse.jface.preference.PreferenceDialog.buttonPressed(PreferenceDialog.java:233)
	at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:625)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:228)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1161)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3477)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3096)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
	at org.eclipse.jface.window.Window.open(Window.java:801)
	at org.eclipse.ui.internal.OpenPreferencesAction.run(OpenPreferencesAction.java:65)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1161)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3477)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3096)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2388)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2352)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2204)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:499)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:333)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:492)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:556)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:511)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1284)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1260)

Comment 2 Ankur Sharma CLA 2009-03-03 14:41:33 EST
Created attachment 127369 [details]
Full Patch

If name is blank, the edit target page will now give an error message is "The target name cannot be blank."
Comment 3 Curtis Windatt CLA 2009-03-03 15:42:28 EST
Applied patch to HEAD.  Only made one change to change the message text if the edit wizard was opened with no name.  In that case the finish button was disabled with no indication why, and editing things didn't cause the error message to appear (only if the name text is modified do things update).