Program: 68481
Project: 68481
Buggy source:
/** 
 * Add aggregate bindings of value series for grouping case.
 * @param query
 * @param seriesDefinitions
 * @param innerMostGroupDef
 * @param valueExprMap
 * @param baseSD
 * @throws ChartException
 */
protected void addValueSeriesAggregateBindingForGrouping(BaseQueryDefinition query,EList<SeriesDefinition> seriesDefinitions,GroupDefinition innerMostGroupDef,Map<String,String[]> valueExprMap,SeriesDefinition baseSD) throws ChartException {
  for (  SeriesDefinition orthSD : seriesDefinitions) {
    Series series=orthSD.getDesignTimeSeries();
    List<Query> qlist=ChartEngine.instance().getDataSetProcessor(series.getClass()).getDataDefinitionsForGrouping(series);
    for (    Query qry : series.getDataDefinition()) {
      String expr=qry.getDefinition();
      if (expr == null || "String_Node_Str".equals(expr)) {
        continue;
      }
      String aggName=ChartUtil.getAggregateFuncExpr(orthSD,baseSD,qry);
      if (aggName == null) {
        if (!bCreateBindingForExpression || ChartExpressionUtil.isRowBinding(expr,false)) {
          continue;
        }
      }
      String name=ChartUtil.generateBindingNameOfValueSeries(qry,orthSD,baseSD);
      if (fNameSet.contains(name)) {
        continue;
      }
      fNameSet.add(name);
      Binding colBinding=new Binding(name);
      colBinding.setDataType(org.eclipse.birt.core.data.DataType.ANY_TYPE);
      if (qlist.contains(qry)) {
        try {
          colBinding.setExportable(false);
          if (aggName != null) {
            setBindingExpressionDueToAggregation(colBinding,expr,aggName);
            if (innerMostGroupDef != null) {
              colBinding.addAggregateOn(innerMostGroupDef.getName());
            }
            colBinding.setAggrFunction(ChartReportItemUtil.convertToDtEAggFunction(aggName));
            IAggregateFunction aFunc=PluginSettings.instance().getAggregateFunction(aggName);
            if (aFunc.getParametersCount() > 0) {
              String[] parameters=ChartUtil.getAggFunParameters(orthSD,baseSD,qry);
              for (int i=0; i < parameters.length && i < aFunc.getParametersCount(); i++) {
                String param=parameters[i];
                colBinding.addArgument(new ScriptExpression(param));
              }
            }
          }
 else {
            exprCodec.decode(expr);
            colBinding.setExpression(ChartReportItemUtil.adaptExpression(exprCodec,modelAdapter,false));
          }
        }
 catch (        DataException e1) {
          throw new ChartException(ChartReportItemPlugin.ID,ChartException.DATA_BINDING,e1);
        }
      }
 else {
        colBinding.setExpression(new ScriptExpression(expr));
      }
      String newExpr=getExpressionForEvaluator(name);
      try {
        query.addBinding(colBinding);
      }
 catch (      DataException e) {
        throw new ChartException(ChartReportItemPlugin.ID,ChartException.DATA_BINDING,e);
      }
      valueExprMap.put(expr,new String[]{name,newExpr});
    }
  }
}

Fixed version (ground truth):
/** 
 * Add aggregate bindings of value series for grouping case.
 * @param query
 * @param seriesDefinitions
 * @param innerMostGroupDef
 * @param valueExprMap
 * @param baseSD
 * @throws ChartException
 */
protected void addValueSeriesAggregateBindingForGrouping(BaseQueryDefinition query,EList<SeriesDefinition> seriesDefinitions,GroupDefinition innerMostGroupDef,Map<String,String[]> valueExprMap,SeriesDefinition baseSD) throws ChartException {
  for (  SeriesDefinition orthSD : seriesDefinitions) {
    Series series=orthSD.getDesignTimeSeries();
    List<Query> qlist=ChartEngine.instance().getDataSetProcessor(series.getClass()).getDataDefinitionsForGrouping(series);
    for (    Query qry : series.getDataDefinition()) {
      String expr=qry.getDefinition();
      if (expr == null || "String_Node_Str".equals(expr)) {
        continue;
      }
      String aggName=ChartUtil.getAggregateFuncExpr(orthSD,baseSD,qry);
      if (aggName == null) {
        if (!bCreateBindingForExpression || exprCodec.isRowBinding(expr,false)) {
          continue;
        }
      }
      String name=ChartUtil.generateBindingNameOfValueSeries(qry,orthSD,baseSD);
      if (fNameSet.contains(name)) {
        continue;
      }
      fNameSet.add(name);
      Binding colBinding=new Binding(name);
      colBinding.setDataType(org.eclipse.birt.core.data.DataType.ANY_TYPE);
      if (qlist.contains(qry)) {
        try {
          colBinding.setExportable(false);
          if (aggName != null) {
            setBindingExpressionDueToAggregation(colBinding,expr,aggName);
            if (innerMostGroupDef != null) {
              colBinding.addAggregateOn(innerMostGroupDef.getName());
            }
            colBinding.setAggrFunction(ChartReportItemUtil.convertToDtEAggFunction(aggName));
            IAggregateFunction aFunc=PluginSettings.instance().getAggregateFunction(aggName);
            if (aFunc.getParametersCount() > 0) {
              String[] parameters=ChartUtil.getAggFunParameters(orthSD,baseSD,qry);
              for (int i=0; i < parameters.length && i < aFunc.getParametersCount(); i++) {
                String param=parameters[i];
                colBinding.addArgument(new ScriptExpression(param));
              }
            }
          }
 else {
            exprCodec.decode(expr);
            colBinding.setExpression(ChartReportItemUtil.adaptExpression(exprCodec,modelAdapter,false));
          }
        }
 catch (        DataException e1) {
          throw new ChartException(ChartReportItemPlugin.ID,ChartException.DATA_BINDING,e1);
        }
      }
 else {
        exprCodec.decode(expr);
        colBinding.setExpression(ChartReportItemUtil.adaptExpression(exprCodec,modelAdapter,false));
      }
      String newExpr=getExpressionForEvaluator(name);
      try {
        query.addBinding(colBinding);
      }
 catch (      DataException e) {
        throw new ChartException(ChartReportItemPlugin.ID,ChartException.DATA_BINDING,e);
      }
      valueExprMap.put(expr,new String[]{name,newExpr});
    }
  }
}