Bug 201352 [regression]NPE when set binding for data into shared table[0005]
Description: NPE when set binding for data inside table which shares from others. Build number:2.2.1.v20070827 Steps to reproduce: 1. Insert a table with dataset binding. 2. Insert another table, set binding to share from the first table. 3. Insert a data item to second table. 4. Select one binding from pop up data dialog and click OK. Expected result: No Exception and binding can be set. Actual result: NPE and fail to set binding. Error log: org.eclipse.birt.report.designer.core.runtime.GUIException: Caused by java.lang.NullPointerException. at org.eclipse.birt.report.designer.core.runtime.GUIException.createGUIException(GUIException.java:76) at org.eclipse.birt.report.designer.internal.ui.util.ExceptionHandler.handle(ExceptionHandler.java:169) at org.eclipse.birt.report.designer.internal.ui.util.ExceptionHandler.handle(ExceptionHandler.java:150) at org.eclipse.birt.report.designer.internal.ui.util.ExceptionHandler.handle(ExceptionHandler.java:89) at org.eclipse.birt.report.designer.internal.ui.dialogs.DataColumnBindingDialog.okPressed(DataColumnBindingDialog.java:235) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:464) at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:616) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293) at org.eclipse.jface.window.Window.runEventLoop(Window.java:820) at org.eclipse.jface.window.Window.open(Window.java:796) at org.eclipse.birt.report.designer.internal.ui.dialogs.BaseDialog.open(BaseDialog.java:109) at org.eclipse.birt.report.designer.internal.ui.editors.schematic.editparts.DataEditPart.performDirectEdit(DataEditPart.java:142) at org.eclipse.birt.report.designer.ui.actions.BaseInsertMenuAction$1.run(BaseInsertMenuAction.java:247) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3659) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3296) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219) at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176) 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:585) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:504) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:443) at org.eclipse.equinox.launcher.Main.run(Main.java:1169) Caused by: java.lang.NullPointerException at org.eclipse.birt.report.designer.internal.ui.dialogs.BindingDialogHelper.newBinding(BindingDialogHelper.java:1154) 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:585) at org.eclipse.birt.report.designer.ui.views.ElementAdapterInvocationHandler.invoke(ElementAdapterInvocationHandler.java:89) at $Proxy1.newBinding(Unknown Source) at org.eclipse.birt.report.designer.internal.ui.dialogs.DataColumnBindingDialog.okPressed(DataColumnBindingDialog.java:229) ... 36 more
UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/dialogs/BindingDialogHelper.java
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
/**
 * 
 */
public class BindingDialogHelper extends AbstractBindingDialogHelper
{
	protected static final String NAME = Messages.getString( "BindingDialogHelper.text.Name" ); 
	protected static final String DATA_TYPE = Messages.getString( "BindingDialogHelper.text.DataType" ); 
	protected static final String FUNCTION = Messages.getString( "BindingDialogHelper.text.Function" ); 
	protected static final String DATA_FIELD = Messages.getString( "BindingDialogHelper.text.DataField" ); 
	protected static final String FILTER_CONDITION = Messages.getString( "BindingDialogHelper.text.Filter" ); 
	protected static final String AGGREGATE_ON = Messages.getString( "BindingDialogHelper.text.AggOn" ); 
	protected static final String TABLE = Messages.getString( "BindingDialogHelper.text.Table" ); 
	protected static final String LIST = Messages.getString( "BindingDialogHelper.text.List" ); 
	protected static final String GROUP = Messages.getString( "BindingDialogHelper.text.Group" ); 
	protected static final String EXPRESSION = Messages.getString( "BindingDialogHelper.text.Expression" ); 
	protected static final String DISPLAY_NAME = Messages.getString( "BindingDialogHelper.text.displayName" ); 
	protected static final String DEFAULT_ITEM_NAME = Messages.getString( "BindingDialogHelper.bindingName.dataitem" ); 
	protected static final String DEFAULT_AGGREGATION_NAME = Messages.getString( "BindingDialogHelper.bindingName.aggregation" ); 
	protected static final IChoiceSet DATA_TYPE_CHOICE_SET = DEUtil.getMetaDataDictionary( )
			.getStructure( ComputedColumn.COMPUTED_COLUMN_STRUCT )
			.getMember( ComputedColumn.DATA_TYPE_MEMBER )
			.getAllowedChoices( );
	protected static final IChoice[] DATA_TYPE_CHOICES = DATA_TYPE_CHOICE_SET.getChoices( null );
	protected String[] dataTypes = ChoiceSetFactory.getDisplayNamefromChoiceSet( DATA_TYPE_CHOICE_SET );