Bug 172819 Error occurs when input Invalid Query in stored procedure data set [07]
Description: Error occurs when input Invalid Query in stored procedure data set [07] Build number: 2.2.0.v20070205-0630 Steps to reproduce: 1, New a Oracle stored procedure data set 2, Input Query Text: {call ROOT.TEST_MJ(?,?,?,?)} 3, Preview the results Expected result: Invalid Query message pops up Actual result: The error log pops up, and we can only press cancel to stop the operation Error log: java.lang.IndexOutOfBoundsException: Index: 3, Size: 3 at java.util.ArrayList.RangeCheck(ArrayList.java:546) at java.util.ArrayList.get(ArrayList.java:321) at org.eclipse.birt.report.data.oda.jdbc.CallStatement.getParameterMetaData(CallStatement.java:1289) at org.eclipse.birt.report.data.oda.jdbc.ui.editors.SQLUtility.setParameterMetaData(SQLUtility.java:123) at org.eclipse.birt.report.data.oda.jdbc.ui.editors.SQLUtility.saveDataSetDesign(SQLUtility.java:86) at org.eclipse.birt.report.data.oda.jdbc.ui.editors.SQLDataSetEditorPage.collectDataSetDesign(SQLDataSetEditorPage.java:446) at org.eclipse.datatools.connectivity.oda.design.internal.ui.DataSetWizardPageCore.finishDataSetDesign(DataSetWizardPageCore.java:366) at org.eclipse.datatools.connectivity.oda.design.internal.ui.DataSetWizardBase.collectDataSetDesignFromPage(DataSetWizardBase.java:326) at org.eclipse.datatools.connectivity.oda.design.internal.ui.DataSetWizardBase.finishDataSetDesign(DataSetWizardBase.java:349) at org.eclipse.datatools.connectivity.oda.design.internal.ui.DataSetWizardBase.getResponseSession(DataSetWizardBase.java:98) at org.eclipse.datatools.connectivity.oda.design.internal.designsession.DataSetDesignSessionBase.finishDataSetDesign(DataSetDesignSessionBase.java:332) at org.eclipse.datatools.connectivity.oda.design.internal.designsession.DataSetDesignSessionBase.finish(DataSetDesignSessionBase.java:167) at org.eclipse.datatools.connectivity.oda.design.ui.designsession.DataSetDesignSession.finish(DataSetDesignSession.java:153) at org.eclipse.birt.report.designer.data.ui.dataset.DataSetEditor.performOk(DataSetEditor.java:379) at org.eclipse.birt.report.designer.data.ui.property.AbstractPropertyDialog.okPressed(AbstractPropertyDialog.java:600) at org.eclipse.birt.report.designer.data.ui.dataset.DataSetEditor.okPressed(DataSetEditor.java:548) at org.eclipse.birt.report.designer.data.ui.property.AbstractPropertyDialog.buttonPressed(AbstractPropertyDialog.java:475) at org.eclipse.jface.dialogs.Dialog$3.widgetSelected(Dialog.java:638)
data/org.eclipse.birt.report.data.oda.jdbc/src/org/eclipse/birt/report/data/oda/jdbc/CallStatement.java
*/
	private String getProcedureName( String text )
	{
		assert text != null;
		String name;
		int start = text.toLowerCase( ).indexOf( "call " ) + 4;
		int end = text.indexOf( "(", start );
		if ( end < start )
			end = text.length( );
		name = text.substring( start, end ).trim( );
		name = escapeIdentifier( name );
		if ( name.indexOf( ";" ) > 0 )
			name = name.substring( 0, name.indexOf( ";" ) );
		return name;
	}
	/**
	 * escape the double quote & bracket
	 * @param text
	 * @return
	 */
	private String escapeIdentifier( String text )
	{
		if ( ( text.startsWith( "\"" ) && text.endsWith( "\"" ) )
				|| ( text.startsWith( "[" ) && text.endsWith( "]" ) ) )
			return text.substring( 1, text.length( ) - 1 );
		else
			return text;
	}
	/**
	 * Converts a RuntimeException which occurred in the setting parameter value