Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 348201 - [binding editor] NPE prevents creation of type binding
Summary: [binding editor] NPE prevents creation of type binding
Status: VERIFIED FIXED
Alias: None
Product: Objectteams
Classification: Tools
Component: OTDT (show other bugs)
Version: 0.8   Edit
Hardware: PC Linux
: P2 major (vote)
Target Milestone: 2.0 RC4   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-03 09:14 EDT by Stephan Herrmann CLA
Modified: 2011-06-04 09:00 EDT (History)
0 users

See Also:


Attachments
proposed fix (4.51 KB, patch)
2011-06-03 10:18 EDT, Stephan Herrmann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Herrmann CLA 2011-06-03 09:14:31 EDT
Trying to create a new type binding in the binding editor fails with the
following exception:

java.lang.NullPointerException
	at org.eclipse.objectteams.otdt.internal.ui.bindingeditor.AddTypeBindingDialog.okPressed(AddTypeBindingDialog.java:473)
	at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:472)
	at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:240)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3586)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3207)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
	at org.eclipse.jface.window.Window.open(Window.java:801)
	at org.eclipse.jdt.internal.ui.dialogs.FilteredTypesSelectionDialog.open(FilteredTypesSelectionDialog.java:509)
	at org.eclipse.objectteams.otdt.internal.ui.bindingeditor.AddTypeBindingDialog.open(AddTypeBindingDialog.java:372)
	at org.eclipse.objectteams.otdt.internal.ui.bindingeditor.BindingEditor$2.widgetSelected(BindingEditor.java:434)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:240)
Comment 1 Stephan Herrmann CLA 2011-06-03 10:18:44 EDT
Created attachment 197304 [details]
proposed fix

This functionality was probably broken by the migration from 
TypeSelectionDialog2 to FilteredTypesSelectionDialog which we did for 
Eclipse 3.5. See in particular http://trac.objectteams.org/ot/changeset/19975

The NPE was caused by accessing getResult() before calling computeResult().

The patch changes this order and inserts a few more checks for safety.
It also introduces more differentiated error messages when some required
selection is not given.
Comment 2 Stephan Herrmann CLA 2011-06-03 10:21:48 EDT
This functionality was completely broken.
The patch is local to the broken class and thus introduces no further risk.

Therefor I've releates the patch for RC4.
Comment 3 Stephan Herrmann CLA 2011-06-04 09:00:12 EDT
Verified using build 201106031540