Program: 73779
Project: 73779
Buggy source:
/** 
 * Add aggregate bindings of value series for grouping case.
 * @param query
 * @param seriesDefinitions
 * @param baseGroupDef
 * @param valueExprMap
 * @param baseSD
 * @throws DataException
 */
protected void addValueSeriesAggregateBindingForGrouping(BaseQueryDefinition query,EList seriesDefinitions,GroupDefinition baseGroupDef,Map valueExprMap,SeriesDefinition baseSD) throws DataException {
  for (Iterator iter=seriesDefinitions.iterator(); iter.hasNext(); ) {
    SeriesDefinition orthSD=(SeriesDefinition)iter.next();
    String expr=((Query)orthSD.getDesignTimeSeries().getDataDefinition().get(0)).getDefinition();
    if (expr != null && !"String_Node_Str".equals(expr)) {
      String aggName=getAggFunExpr(orthSD,baseSD);
      if (aggName != null && !"String_Node_Str".equals(aggName)) {
        String name=generateUniqueBindingName(expr);
        Binding colBinding=new Binding(name);
        colBinding.setDataType(org.eclipse.birt.core.data.DataType.ANY_TYPE);
        colBinding.setExpression(new ScriptExpression(expr));
        if (baseGroupDef != null) {
          colBinding.addAggregateOn(baseGroupDef.getName());
        }
        try {
          colBinding.setAggrFunction(ChartReportItemUtil.convertToDtEAggFunction(aggName));
          IAggregateFunction aFunc=PluginSettings.instance().getAggregateFunction(aggName);
          if (aFunc.getParametersCount() > 0) {
            Object[] parameters=getAggFunParameters(orthSD,baseSD);
            for (int i=0; i < parameters.length && i < aFunc.getParametersCount(); i++) {
              String param=(String)parameters[i];
              colBinding.addArgument(new ScriptExpression(param));
            }
          }
        }
 catch (        ChartException e) {
          logger.log(e);
        }
        String newExpr=getExpressionForEvaluator(name);
        ((Query)orthSD.getDesignTimeSeries().getDataDefinition().get(0)).setDefinition(newExpr);
        query.addBinding(colBinding);
        valueExprMap.put(expr,newExpr);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Add aggregate bindings of value series for grouping case.
 * @param query
 * @param seriesDefinitions
 * @param innerGroupDef
 * @param valueExprMap
 * @param baseSD
 * @throws DataException
 */
protected void addValueSeriesAggregateBindingForGrouping(BaseQueryDefinition query,EList seriesDefinitions,GroupDefinition innerGroupDef,Map valueExprMap,SeriesDefinition baseSD) throws DataException {
  for (Iterator iter=seriesDefinitions.iterator(); iter.hasNext(); ) {
    SeriesDefinition orthSD=(SeriesDefinition)iter.next();
    String expr=((Query)orthSD.getDesignTimeSeries().getDataDefinition().get(0)).getDefinition();
    if (expr != null && !"String_Node_Str".equals(expr)) {
      String aggName=getAggFunExpr(orthSD,baseSD);
      if (aggName != null && !"String_Node_Str".equals(aggName)) {
        String name=generateUniqueBindingName(expr);
        Binding colBinding=new Binding(name);
        colBinding.setDataType(org.eclipse.birt.core.data.DataType.ANY_TYPE);
        colBinding.setExpression(new ScriptExpression(expr));
        if (innerGroupDef != null) {
          colBinding.addAggregateOn(innerGroupDef.getName());
        }
        try {
          colBinding.setAggrFunction(ChartReportItemUtil.convertToDtEAggFunction(aggName));
          IAggregateFunction aFunc=PluginSettings.instance().getAggregateFunction(aggName);
          if (aFunc.getParametersCount() > 0) {
            Object[] parameters=getAggFunParameters(orthSD,baseSD);
            for (int i=0; i < parameters.length && i < aFunc.getParametersCount(); i++) {
              String param=(String)parameters[i];
              colBinding.addArgument(new ScriptExpression(param));
            }
          }
        }
 catch (        ChartException e) {
          logger.log(e);
        }
        String newExpr=getExpressionForEvaluator(name);
        ((Query)orthSD.getDesignTimeSeries().getDataDefinition().get(0)).setDefinition(newExpr);
        query.addBinding(colBinding);
        valueExprMap.put(expr,newExpr);
      }
    }
  }
}