Program: 65087
Project: 65087
Buggy source:
/** 
 * @param dataExpr
 * @param scope
 * @return
 * @throws BirtException
 */
private Object doEvaluateRawExpression(IBaseExpression dataExpr,Scriptable scope,boolean javaType,ScriptContext cx,DataSetRuntime dataSet) throws BirtException {
  if (dataSet == null) {
    return doEvaluateRawExpression(dataExpr,scope,javaType,cx);
  }
  String dataSetColumn=extractDirectColumn(dataExpr,cx,false);
  if (dataSetColumn != null) {
    if (dataSet.getCurrentRow() != null && dataSet.getCurrentRow().getResultClass().getFieldIndex(dataSetColumn) >= 0) {
      Object value=dataSet.getCurrentRow().getFieldValue(dataSetColumn);
      return DataTypeUtil.convert(value,dataExpr.getDataType());
    }
  }
  String rowName=extractDirectColumn(dataExpr,cx,true);
  if (rowName != null) {
    Scriptable scriptable=dataSet.getJSResultRowObject();
    if (scriptable instanceof JSResultSetRow) {
      JSResultSetRow resultSetRow=(JSResultSetRow)scriptable;
      IBinding b=resultSetRow.getBinding(rowName);
      if (resultSetRow.getOdiResult().getCurrentResult().getResultClass().getFieldIndex(rowName) >= 0) {
        Object value=resultSetRow.getOdiResult().getCurrentResult().getFieldValue(rowName);
        return DataTypeUtil.convert(value,b.getDataType());
      }
      if (b != null && b.getAggrFunction() == null) {
        IBaseExpression expr=b.getExpression();
        dataSetColumn=extractDirectColumn(expr,cx,false);
        if (dataSetColumn != null) {
          if (dataSet.getCurrentRow() != null && dataSet.getCurrentRow().getResultClass().getFieldIndex(dataSetColumn) >= 0) {
            Object value=dataSet.getCurrentRow().getFieldValue(dataSetColumn);
            return DataTypeUtil.convert(value,b.getDataType());
          }
        }
      }
    }
 else {
      if (dataSet.getCurrentRow() != null && dataSet.getCurrentRow().getResultClass().getFieldIndex(rowName) >= 0) {
        Object value=dataSet.getCurrentRow().getFieldValue(rowName);
        return DataTypeUtil.convert(value,dataExpr.getDataType());
      }
    }
  }
  return doEvaluateRawExpression(dataExpr,scope,javaType,cx);
}

Fixed version (ground truth):
/** 
 * @param dataExpr
 * @param scope
 * @return
 * @throws BirtException
 */
private Object doEvaluateRawExpression(IBaseExpression dataExpr,Scriptable scope,boolean javaType,ScriptContext cx,DataSetRuntime dataSet) throws BirtException {
  if (dataSet == null) {
    return doEvaluateRawExpression(dataExpr,scope,javaType,cx);
  }
  String dataSetColumn=extractDirectColumn(dataExpr,cx,false);
  if (dataSetColumn != null) {
    if (dataSet.getCurrentRow() != null && dataSet.getCurrentRow().getResultClass().getFieldIndex(dataSetColumn) >= 0) {
      Object value=dataSet.getCurrentRow().getFieldValue(dataSetColumn);
      return DataTypeUtil.convert(value,dataExpr.getDataType());
    }
  }
  String rowName=extractDirectColumn(dataExpr,cx,true);
  if (rowName != null) {
    Scriptable scriptable=dataSet.getJSResultRowObject();
    if (scriptable instanceof JSResultSetRow) {
      JSResultSetRow resultSetRow=(JSResultSetRow)scriptable;
      IBinding b=resultSetRow.getBinding(rowName);
      if (b != null && b.getAggrFunction() == null) {
        IBaseExpression expr=b.getExpression();
        dataSetColumn=extractDirectColumn(expr,cx,false);
        if (dataSetColumn != null) {
          if (dataSet.getCurrentRow() != null && dataSet.getCurrentRow().getResultClass().getFieldIndex(dataSetColumn) >= 0) {
            Object value=dataSet.getCurrentRow().getFieldValue(dataSetColumn);
            return DataTypeUtil.convert(value,b.getDataType());
          }
        }
      }
    }
 else {
      if (dataSet.getCurrentRow() != null && dataSet.getCurrentRow().getResultClass().getFieldIndex(rowName) >= 0) {
        Object value=dataSet.getCurrentRow().getFieldValue(rowName);
        return DataTypeUtil.convert(value,dataExpr.getDataType());
      }
    }
  }
  return doEvaluateRawExpression(dataExpr,scope,javaType,cx);
}