Program: 68302
Project: 68302
Buggy source:
/** 
 * Prepare data expression evaluator for query share with table.
 * @param cm
 * @param columnExpression
 * @return
 * @throws BirtException
 * @throws AdapterException
 * @throws DataException
 * @throws ChartException
 */
private IDataRowExpressionEvaluator createShareBindingEvaluator(Chart cm,List<String> columnExpression) throws BirtException, AdapterException, DataException, ChartException {
  IQueryResults actualResultSet;
  QueryDefinition queryDefn=new QueryDefinition();
  int maxRow=getMaxRow();
  queryDefn.setMaxRows(maxRow);
  final Map<String,String> bindingExprsMap=new HashMap<String,String>();
  Iterator<ComputedColumnHandle> iterator=ChartReportItemUtil.getColumnDataBindings(itemHandle);
  List<ComputedColumnHandle> columnList=new ArrayList<ComputedColumnHandle>();
  while (iterator.hasNext()) {
    columnList.add(iterator.next());
  }
  generateShareBindingsWithTable(getPreviewHeadersInfo(columnList),queryDefn,session,bindingExprsMap);
  addCustomExpressions(queryDefn,cm,columnExpression,bindingExprsMap);
  Iterator<?> filtersIterator=getPropertyIterator(itemHandle.getPropertyHandle(ExtendedItemHandle.FILTER_PROP));
  if (filtersIterator != null) {
    while (filtersIterator.hasNext()) {
      IFilterDefinition filter=session.getModelAdaptor().adaptFilter((FilterConditionHandle)filtersIterator.next());
      queryDefn.addFilter(filter);
    }
  }
  IPreparedQuery pq=session.prepare(queryDefn,getAppContext(getMaxRow(),false));
  actualResultSet=(IQueryResults)session.execute(pq,null,new ScriptContext());
  if (actualResultSet != null) {
    return new BaseGroupedQueryResultSetEvaluator(actualResultSet.getResultIterator(),ChartReportItemUtil.isSetSummaryAggregation(cm),cm){
      public Object evaluate(      String expression){
        try {
          String newExpr=bindingExprsMap.get(expression);
          if (newExpr != null) {
            return fResultIterator.getValue(newExpr);
          }
 else {
            return fResultIterator.getValue(expression);
          }
        }
 catch (        BirtException e) {
          sLogger.log(e);
        }
        return null;
      }
    }
;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Prepare data expression evaluator for query share with table.
 * @param cm
 * @param columnExpression
 * @return
 * @throws BirtException
 * @throws AdapterException
 * @throws DataException
 * @throws ChartException
 */
private IDataRowExpressionEvaluator createShareBindingEvaluator(Chart cm,List<String> columnExpression) throws BirtException, AdapterException, DataException, ChartException {
  IQueryResults actualResultSet;
  QueryDefinition queryDefn=new QueryDefinition();
  int maxRow=getMaxRow();
  queryDefn.setMaxRows(maxRow);
  final Map<String,String> bindingExprsMap=new HashMap<String,String>();
  Iterator<ComputedColumnHandle> iterator=ChartReportItemUtil.getColumnDataBindings(itemHandle);
  List<ComputedColumnHandle> columnList=new ArrayList<ComputedColumnHandle>();
  while (iterator.hasNext()) {
    columnList.add(iterator.next());
  }
  generateShareBindingsWithTable(getPreviewHeadersInfo(columnList),queryDefn,session,bindingExprsMap);
  addCustomExpressions(queryDefn,cm,columnExpression,bindingExprsMap);
  Iterator<?> filtersIterator=getPropertyIterator(itemHandle.getPropertyHandle(ExtendedItemHandle.FILTER_PROP));
  if (filtersIterator != null) {
    while (filtersIterator.hasNext()) {
      IFilterDefinition filter=session.getModelAdaptor().adaptFilter((FilterConditionHandle)filtersIterator.next());
      queryDefn.addFilter(filter);
    }
  }
  DataSetHandle dataSetHandle=ChartItemUtil.getBindingDataSet(itemHandle);
  if (needDefineDataSet(dataSetHandle)) {
    defineDataSet(dataSetHandle,session,true,false);
  }
  IPreparedQuery pq=session.prepare(queryDefn,getAppContext(getMaxRow(),false));
  actualResultSet=(IQueryResults)session.execute(pq,null,new ScriptContext());
  if (actualResultSet != null) {
    return new BaseGroupedQueryResultSetEvaluator(actualResultSet.getResultIterator(),ChartReportItemUtil.isSetSummaryAggregation(cm),cm){
      public Object evaluate(      String expression){
        try {
          String newExpr=bindingExprsMap.get(expression);
          if (newExpr != null) {
            return fResultIterator.getValue(newExpr);
          }
 else {
            return fResultIterator.getValue(expression);
          }
        }
 catch (        BirtException e) {
          sLogger.log(e);
        }
        return null;
      }
    }
;
  }
  return null;
}