Bug 123722 Java based scripting -> getExpressionValue(int i) of IRowData returns unreasonable value
public void onPrepare( IRow row, IReportContext reportContext ) { try { row.setBookmark( "\"row-bookmark\"" ); System.out.println( row.getBookmark( ) ); } catch ( Exception e ) { e.printStackTrace( ); } } public void onCreate(IRowInstance rowInstance, IReportContext reportContext) { try { IRowData rowData = rowInstance.getRowData( ); Object int2 = rowData.getExpressionValue( 1 ); System.out.println( int2 ); } catch ( Exception e ) { e.printStackTrace( ); } } Consider the script above, according to Javadoc, rowData.getExpressionValue( 1 ) will return the first data expr. of the row, i.e. the value of the first column. However, it was noticed that "row-bookmark" was returned instead. And if i used rowData.getExpressionValue( 2 ), then i got the right value. So if it was the correct implementation, it should be clearly stated in Javadoc.
engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/script/internal/RowData.java
* A class representing expression results. Can be used to get values of
 * expressions defined on a report item. Implements lazy lookup; values are not
 * evaluated until they are requested.
 * 
 * Some processing is done to the expressions to make it easier for the user.
 * Example: It is ok to write row[CUSTOMERNAME] even though the correct
 * expression would be row["CUSTOMERNAME"]
 * 
 */
public class RowData implements IRowData
{
	private IResultIterator rsIterator;
	private Collection expressions;
	private static final Pattern rowWithIndex = Pattern.compile(
			"(row\\[\\d+\\])", Pattern.CASE_INSENSITIVE );
	private static final Pattern rowWithWord = Pattern.compile(
			"(row\\[\\w+\\])", Pattern.CASE_INSENSITIVE );
	public RowData( IResultIterator rsIterator, Collection expressions )
	{
		this.rsIterator = rsIterator;
		this.expressions = expressions;
	}
	/**
	 * Get the value of the provided expression. The expression must be defined
	 * on the report item. Some processing is done to the expression to make
	 * thing easier. It is ok to for an expression to contain things like
	 * row[CUSTOMERNAME] for example (will be replaced with row["CUSTOMENAME"]).
	 * row[123] will be kept as row[123] (index lookup). The regex used is to
	 * find things to replace is: row\\[\\w+\\], Pattern.CASE_INSENSITIVE minus
	 * row\\[\\d+\\], Pattern.CASE_INSENSITIVE.