Bug 116355 [SPM] Error occurred when dnd a table to the sql statement in the "Edit Data Set" dialog on Mac
Description: Error message occurred sometimes when drag and drop a table to the sql statement in the "Edit data set" dialog. Steps to reproduce: 1.Create a sample data source, and create a data set "select * from CLASSICMODELS.ORDERS". 2.In the available items listed other tables of the sample data source. Select OFFICES table, and this time i want to drag and drop the table name to the sql statement. Error occurred. Expected Result: DND action is supported on Mac as Windows. Actual Result: See error log: org.eclipse.swt.SWTException: Data does not have correct format for type at org.eclipse.swt.dnd.DND.error(DND.java:257) at org.eclipse.swt.dnd.DND.error(DND.java:208) at org.eclipse.swt.dnd.TextTransfer.javaToNative(TextTransfer.java:61) at org.eclipse.swt.dnd.DragSource.dragSendDataProc(DragSource.java:345) at org.eclipse.swt.dnd.DragSource.DragSendDataProc(DragSource.java:182) at org.eclipse.swt.internal.carbon.OS.GetFlavorDataSize(Native Method) at org.eclipse.swt.dnd.DropTarget.dragReceiveHandler (DropTarget.java:374) at org.eclipse.swt.dnd.DropTarget.DragReceiveHandler (DropTarget.java:233) at org.eclipse.swt.internal.carbon.OS.TrackDrag(Native Method) at org.eclipse.swt.dnd.DragSource.drag(DragSource.java:307) at org.eclipse.swt.dnd.DragSource.access$0(DragSource.java:239) at org.eclipse.swt.dnd.DragSource$1.handleEvent(DragSource.java:159) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1380) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1404) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1389) at org.eclipse.swt.widgets.Display.dragDetect(Display.java:959) at org.eclipse.swt.widgets.Control.kEventMouseDragged(Control.java:1474) at org.eclipse.swt.widgets.Widget.mouseProc(Widget.java:1212) at org.eclipse.swt.widgets.Display.mouseProc(Display.java:2573) at org.eclipse.swt.internal.carbon.OS.SendEventToEventTarget(Native Method) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2682) at org.eclipse.jface.window.Window.runEventLoop(Window.java:809) at org.eclipse.jface.window.Window.open(Window.java:787) at org.eclipse.birt.report.designer.internal.ui.dialogs.BaseDialog.open (BaseDialog.java:145) at org.eclipse.birt.report.designer.internal.ui.views.data.providers.DataSetNodePro vider.performEdit(DataSetNodeProvider.java:156) at org.eclipse.birt.report.designer.internal.ui.views.DefaultNodeProvider.performRe quest(DefaultNodeProvider.java:307) at org.eclipse.birt.report.designer.internal.ui.views.actions.EditAction.doAction (EditAction.java:70) at org.eclipse.birt.report.designer.internal.ui.views.actions.AbstractElementAction .run(AbstractElementAction.java:60) at org.eclipse.birt.report.designer.internal.ui.views.RenameListener.doubleClick (RenameListener.java:211) at org.eclipse.jface.viewers.StructuredViewer$1.run (StructuredViewer.java:720) at org.eclipse.core.internal.runtime.InternalPlatform.run (InternalPlatform.java:1044) at org.eclipse.core.runtime.Platform.run(Platform.java:783) at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:44) at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:148) at org.eclipse.jface.viewers.StructuredViewer.fireDoubleClick (StructuredViewer.java:718) at org.eclipse.jface.viewers.StructuredViewer.handleDoubleSelect (StructuredViewer.java:950) at org.eclipse.jface.viewers.StructuredViewer$4.widgetDefaultSelected (StructuredViewer.java:1057) at org.eclipse.jface.util.OpenStrategy.fireDefaultSelectionEvent (OpenStrategy.java:219) at org.eclipse.jface.util.OpenStrategy.access$0(OpenStrategy.java:216) at org.eclipse.jface.util.OpenStrategy$1.handleEvent (OpenStrategy.java:275) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1380) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1404) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1389) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1237) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3060) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2712) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1699) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench (Workbench.java:367) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run (IDEApplication.java:103) at org.eclipse.core.internal.runtime.PlatformActivator$1.run (PlatformActivator.java:226) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:376) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:163) 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:324) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334) at org.eclipse.core.launcher.Main.basicRun(Main.java:278) at org.eclipse.core.launcher.Main.run(Main.java:973) at org.eclipse.core.launcher.Main.main(Main.java:948) org.eclipse.birt.data.engine.core.DataException: Failed to prepare the following query for the data set type (org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet). [select * from CLASSICMODELS.ORDERDETAILS where ] Error preparing SQL statement Syntax error: Encountered "<EOF>" at line 1, column 47. at org.eclipse.birt.data.engine.odaconsumer.Connection.prepareOdaQuery (Connection.java:232) at org.eclipse.birt.data.engine.odaconsumer.Connection.prepareStatement (Connection.java:158) at org.eclipse.birt.data.engine.executor.DataSource.prepareStatement (DataSource.java:196) at org.eclipse.birt.data.engine.executor.DataSourceQuery.prepare (DataSourceQuery.java:291) at org.eclipse.birt.data.engine.impl.PreparedExtendedDSQuery$ExtendedDSQueryExecuto r.prepareOdiQuery(PreparedExtendedDSQuery.java:324) at org.eclipse.birt.data.engine.impl.PreparedQuery$Executor.prepareExecution (PreparedQuery.java:563) at org.eclipse.birt.data.engine.impl.PreparedQuery$Executor.access$000 (PreparedQuery.java:436) at org.eclipse.birt.data.engine.impl.PreparedQuery.doPrepare (PreparedQuery.java:208) at org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery.execute (PreparedDataSourceQuery.java:145) at org.eclipse.birt.report.designer.internal.ui.util.DataSetManager.execute (DataSetManager.java:243) at org.eclipse.birt.report.designer.internal.ui.util.DataSetManager.getColumns (DataSetManager.java:195) at org.eclipse.birt.report.designer.internal.ui.util.DataSetManager.getColumns (DataSetManager.java:131) at org.eclipse.birt.report.designer.internal.ui.util.DataSetManager.refresh (DataSetManager.java:103) at org.eclipse.birt.report.designer.internal.ui.views.data.DataViewTreeViewerPage$2 .run(DataViewTreeViewerPage.java:431) 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:2932) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2715) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1699) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench (Workbench.java:367) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run (IDEApplication.java:103) at org.eclipse.core.internal.runtime.PlatformActivator$1.run (PlatformActivator.java:226) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:376) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:163) 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:324) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334) at org.eclipse.core.launcher.Main.basicRun(Main.java:278) at org.eclipse.core.launcher.Main.run(Main.java:973) at org.eclipse.core.launcher.Main.main(Main.java:948) Caused by: org.eclipse.birt.report.data.oda.jdbc.JDBCException: Error preparing SQL statement Syntax error: Encountered "<EOF>" at line 1, column 47. at org.eclipse.birt.report.data.oda.jdbc.Statement.prepare (Statement.java:124) at org.eclipse.datatools.connectivity.oda.consumer.helper.OdaQuery.doPrepare (OdaQuery.java:206) at org.eclipse.datatools.connectivity.oda.consumer.helper.OdaQuery.prepare (OdaQuery.java:166) at org.eclipse.birt.data.engine.odaconsumer.Connection.prepareOdaQuery (Connection.java:221) ... 33 more Caused by: SQL Exception: Syntax error: Encountered "<EOF>" at line 1, column 47. at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java) at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException (TransactionResourceImpl.java) at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException (TransactionResourceImpl.java) at org.apache.derby.impl.jdbc.EmbedConnection.handleException (EmbedConnection.java) at org.apache.derby.impl.jdbc.ConnectionChild.handleException (ConnectionChild.java) at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init> (EmbedPreparedStatement.java) at org.apache.derby.impl.jdbc.EmbedPreparedStatement20.<init> (EmbedPreparedStatement20.java) at org.apache.derby.impl.jdbc.EmbedPreparedStatement30.<init> (EmbedPreparedStatement30.java) at org.apache.derby.jdbc.Driver30.newEmbedPreparedStatement (Driver30.java) at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement (EmbedConnection.java) at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement (EmbedConnection.java) at org.eclipse.birt.report.data.oda.jdbc.Statement.prepare (Statement.java:120) ... 36 more
data/org.eclipse.birt.report.data.oda.jdbc.ui/src/org/eclipse/birt/report/data/oda/jdbc/ui/editors/SQLDataSetEditorPage.java
}
		try
		{
			Image image = tableImage;
		
			if ( tablesRs != null )
			{
				int numberOfTable;
				
				Preferences preferences = JdbcPlugin.getDefault( ).getPluginPreferences( );
				if ( preferences.contains( DateSetPreferencePage.USER_MAX_NUM_OF_TABLE_EACH_SCHEMA ) )
				{
					numberOfTable = preferences.getInt( DateSetPreferencePage.USER_MAX_NUM_OF_TABLE_EACH_SCHEMA );
				}
				else
				{
					numberOfTable = DateSetPreferencePage.DEFAULT_MAX_NUM_OF_TABLE_EACH_SCHEMA;
					preferences.setValue( DateSetPreferencePage.USER_MAX_NUM_OF_TABLE_EACH_SCHEMA,
							numberOfTable );
				}
				int count = 0;
				while ( tablesRs.next( ) && count < numberOfTable )
				{
					String tableName = tablesRs.getString( "TABLE_NAME" );
					String type = tablesRs.getString( "TABLE_TYPE" );
					if ( type.equalsIgnoreCase( "SYSTEM TABLE" ) )
						continue;
					
					
					int dbType = DbObject.TABLE_TYPE;