Program: 72161
Project: 72161
Buggy source:
/** 
 * Adds min and max binding to parent query definition
 * @param parent
 * @throws BirtException
 */
private void addMinMaxBinding(ICubeQueryDefinition parent) throws BirtException {
  List bs=parent.getBindings();
  Axis xAxis=(Axis)((ChartWithAxes)cm).getAxes().get(0);
  SeriesDefinition sdValue=(SeriesDefinition)((ChartWithAxes)cm).getOrthogonalAxes(xAxis,true)[0].getSeriesDefinitions().get(0);
  Query queryValue=(Query)sdValue.getDesignTimeSeries().getDataDefinition().get(0);
  String bindingValue=ChartXTabUtil.getBindingName(queryValue.getDefinition(),false);
  String maxBindingName=ChartReportItemConstants.QUERY_MAX + bindingValue;
  String minBindingName=ChartReportItemConstants.QUERY_MIN + bindingValue;
  for (int i=0; i < bs.size(); i++) {
    Binding binding=(Binding)bs.get(i);
    if (binding.getBindingName().equals(maxBindingName) || binding.getBindingName().equals(minBindingName)) {
      return;
    }
  }
  for (Iterator bindings=ChartReportItemUtil.getAllColumnBindingsIterator(handle); bindings.hasNext(); ) {
    ComputedColumnHandle column=(ComputedColumnHandle)bindings.next();
    if (column.getName().equals(bindingValue)) {
      IBinding maxBinding=new Binding(maxBindingName);
      maxBinding.setExpression(new ScriptExpression(queryValue.getDefinition()));
      maxBinding.setAggrFunction(IBuildInAggregation.TOTAL_MAX_FUNC);
      IBinding minBinding=new Binding(minBindingName);
      minBinding.setExpression(new ScriptExpression(queryValue.getDefinition()));
      minBinding.setAggrFunction(IBuildInAggregation.TOTAL_MIN_FUNC);
      ICubeOperation op=ChartXTabUtil.getCubeElementFactory().getCubeOperationFactory().createAddingNestAggregationsOperation(new IBinding[]{maxBinding,minBinding});
      parent.addCubeOperation(op);
      break;
    }
  }
}

Fixed version (ground truth):
/** 
 * Adds min and max binding to parent query definition
 * @param parent
 * @throws BirtException
 */
private void addMinMaxBinding(ICubeQueryDefinition parent) throws BirtException {
  List<IBinding> bs=parent.getBindings();
  Axis xAxis=(Axis)((ChartWithAxes)cm).getAxes().get(0);
  SeriesDefinition sdValue=(SeriesDefinition)((ChartWithAxes)cm).getOrthogonalAxes(xAxis,true)[0].getSeriesDefinitions().get(0);
  Query queryValue=(Query)sdValue.getDesignTimeSeries().getDataDefinition().get(0);
  String bindingValue=ChartXTabUtil.getBindingName(queryValue.getDefinition(),false);
  String maxBindingName=ChartReportItemConstants.QUERY_MAX + bindingValue;
  String minBindingName=ChartReportItemConstants.QUERY_MIN + bindingValue;
  for (int i=0; i < bs.size(); i++) {
    IBinding binding=bs.get(i);
    if (binding.getBindingName().equals(maxBindingName) || binding.getBindingName().equals(minBindingName)) {
      return;
    }
  }
  for (Iterator<ComputedColumnHandle> bindings=ChartReportItemUtil.getAllColumnBindingsIterator(handle); bindings.hasNext(); ) {
    ComputedColumnHandle column=bindings.next();
    if (column.getName().equals(bindingValue)) {
      IBinding maxBinding=new Binding(maxBindingName);
      maxBinding.setExpression(new ScriptExpression(queryValue.getDefinition()));
      maxBinding.setAggrFunction(IBuildInAggregation.TOTAL_MAX_FUNC);
      maxBinding.setExportable(false);
      IBinding minBinding=new Binding(minBindingName);
      minBinding.setExpression(new ScriptExpression(queryValue.getDefinition()));
      minBinding.setAggrFunction(IBuildInAggregation.TOTAL_MIN_FUNC);
      minBinding.setExportable(false);
      ICubeOperation op=ChartXTabUtil.getCubeElementFactory().getCubeOperationFactory().createAddingNestAggregationsOperation(new IBinding[]{maxBinding,minBinding});
      parent.addCubeOperation(op);
      break;
    }
  }
}