Program: 65241
Project: 65241
Buggy source:
/** 
 * Create query definition.
 * @param odaDataSet
 * @param expressions
 * @return
 * @throws ChartException
 */
private QueryDefinition createQueryDefinition(OdaDataSetDesign odaDataSet,String[] expressions) throws ChartException {
  QueryDefinition queryDefn=new QueryDefinition();
  queryDefn.setDataSetName(odaDataSet.getName());
  try {
    initDefaultBindings(queryDefn);
    String groupName="String_Node_Str";
    GroupDefinition gd=new GroupDefinition(groupName);
    gd.setKeyExpression(expressions[0]);
    gd.setInterval(IGroupDefinition.NO_INTERVAL);
    gd.setIntervalRange(0);
    for (int i=0; i < expressions.length; i++) {
      String expr=expressions[i];
      Binding colBinding=null;
      if (i == 1) {
        String newStr=ChartUtil.escapeSpecialCharacters(expr + "String_Node_Str" + "String_Node_Str");
        colBinding=new Binding(newStr);
        colBinding.setExpression(null);
        colBinding.setAggrFunction(IBuildInAggregation.TOTAL_COUNT_FUNC);
        colBinding.addAggregateOn(groupName);
        colBinding.addArgument(new ScriptExpression(expressions[i]));
        expressionMap.put(ExpressionUtil.createRowExpression(newStr),newStr);
      }
 else {
        colBinding=new Binding(expr);
        colBinding.setExpression(new ScriptExpression(expr));
      }
      queryDefn.addBinding(colBinding);
    }
    queryDefn.addGroup(gd);
  }
 catch (  DataException e) {
    throw new ChartException(ChartExamplesPlugin.ID,ChartException.DATA_BINDING,e);
  }
  return queryDefn;
}

Fixed version (ground truth):
/** 
 * Create query definition.
 * @param chart
 * @param odaDataSet
 * @return
 * @throws ChartException
 */
private QueryDefinition createQueryDefinition(Chart chart,OdaDataSetDesign odaDataSet) throws ChartException {
  QueryDefinition queryDefn=new QueryDefinition();
  queryDefn.setDataSetName(odaDataSet.getName());
  try {
    initDefaultBindings(queryDefn);
    SeriesDefinition baseSD=ChartUtil.getBaseSeriesDefinitions(chart).get(0);
    SeriesDefinition orthSD=ChartUtil.getAllOrthogonalSeriesDefinitions(chart).get(0);
    String categoryExpr=baseSD.getDesignTimeSeries().getDataDefinition().get(0).getDefinition();
    String groupName="String_Node_Str";
    GroupDefinition gd=new GroupDefinition(groupName);
    gd.setKeyExpression(categoryExpr);
    gd.setInterval(IGroupDefinition.NO_INTERVAL);
    gd.setIntervalRange(0);
    queryDefn.addGroup(gd);
    Binding colBinding=new Binding(categoryExpr);
    colBinding.setExpression(new ScriptExpression(categoryExpr));
    queryDefn.addBinding(colBinding);
    String valueBinding=ChartUtil.generateBindingNameOfValueSeries(orthSD.getDesignTimeSeries().getDataDefinition().get(0),orthSD,baseSD,true);
    colBinding=new Binding(valueBinding);
    colBinding.setExpression(null);
    colBinding.setAggrFunction(IBuildInAggregation.TOTAL_COUNT_FUNC);
    colBinding.addAggregateOn(groupName);
    colBinding.addArgument(new ScriptExpression(orthSD.getDesignTimeSeries().getDataDefinition().get(0).getDefinition()));
    expressionMap.put(ExpressionUtil.createRowExpression(valueBinding),valueBinding);
    queryDefn.addBinding(colBinding);
  }
 catch (  DataException e) {
    throw new ChartException(ChartExamplesPlugin.ID,ChartException.DATA_BINDING,e);
  }
  return queryDefn;
}