Program: 51610
Project: 51610
Buggy source:
public void loadAggregations(ArrayList batches,Collection pinnedSegments){
  for (Iterator batchIter=batches.iterator(); batchIter.hasNext(); ) {
    Batch batch=(Batch)batchIter.next();
    ArrayList requests=batch.requests;
    CellRequest firstRequest=(CellRequest)requests.get(0);
    RolapStar.Column[] columns=firstRequest.getColumns();
    ArrayList measuresList=new ArrayList();
    HashSet[] valueSets=new HashSet[columns.length];
    for (int i=0; i < valueSets.length; i++) {
      valueSets[i]=new HashSet();
    }
    for (int i=0, count=requests.size(); i < count; i++) {
      CellRequest request=(CellRequest)requests.get(i);
      for (int j=0; j < columns.length; j++) {
        Object value=request.getValueList().get(j);
        Util.assertTrue(!(value instanceof Object[]),"String_Node_Str");
        valueSets[j].add(value);
      }
      RolapStar.Measure measure=request.getMeasure();
      if (!measuresList.contains(measure)) {
        if (measuresList.size() > 0) {
          Util.assertTrue(measure.table.star == ((RolapStar.Measure)measuresList.get(0)).table.star);
        }
        measuresList.add(measure);
      }
    }
    Object[][] constraintses=new Object[columns.length][];
    for (int j=0; j < columns.length; j++) {
      Object[] constraints;
      HashSet valueSet=valueSets[j];
      if (valueSet == null) {
        constraints=null;
      }
 else {
        constraints=valueSet.toArray();
      }
      constraintses[j]=constraints;
    }
    while (true) {
      RolapStar.Measure distinctMeasure=getFirstDistinctMeasure(measuresList);
      if (distinctMeasure == null) {
        break;
      }
      final String expr=distinctMeasure.expression.getGenericExpression();
      final ArrayList distinctMeasuresList=new ArrayList();
      for (int i=0; i < measuresList.size(); ) {
        RolapStar.Measure measure=(RolapStar.Measure)measuresList.get(i);
        if (measure.aggregator.distinct && measure.expression.getGenericExpression().equals(expr)) {
          measuresList.remove(i);
          distinctMeasuresList.add(distinctMeasure);
        }
 else {
          i++;
        }
      }
      RolapStar.Measure[] measures=(RolapStar.Measure[])distinctMeasuresList.toArray(new RolapStar.Measure[0]);
      loadAggregation(measures,columns,constraintses,pinnedSegments);
    }
    RolapStar.Measure[] measures=(RolapStar.Measure[])measuresList.toArray(new RolapStar.Measure[0]);
    loadAggregation(measures,columns,constraintses,pinnedSegments);
  }
}

Fixed version (ground truth):
public void loadAggregations(ArrayList batches,Collection pinnedSegments){
  for (Iterator batchIter=batches.iterator(); batchIter.hasNext(); ) {
    Batch batch=(Batch)batchIter.next();
    ArrayList requests=batch.requests;
    CellRequest firstRequest=(CellRequest)requests.get(0);
    RolapStar.Column[] columns=firstRequest.getColumns();
    ArrayList measuresList=new ArrayList();
    HashSet[] valueSets=new HashSet[columns.length];
    for (int i=0; i < valueSets.length; i++) {
      valueSets[i]=new HashSet();
    }
    for (int i=0, count=requests.size(); i < count; i++) {
      CellRequest request=(CellRequest)requests.get(i);
      for (int j=0; j < columns.length; j++) {
        Object value=request.getValueList().get(j);
        Util.assertTrue(!(value instanceof Object[]),"String_Node_Str");
        valueSets[j].add(value);
      }
      RolapStar.Measure measure=request.getMeasure();
      if (!measuresList.contains(measure)) {
        if (measuresList.size() > 0) {
          Util.assertTrue(measure.table.star == ((RolapStar.Measure)measuresList.get(0)).table.star);
        }
        measuresList.add(measure);
      }
    }
    Object[][] constraintses=new Object[columns.length][];
    for (int j=0; j < columns.length; j++) {
      Object[] constraints;
      HashSet valueSet=valueSets[j];
      if (valueSet == null) {
        constraints=null;
      }
 else {
        constraints=valueSet.toArray();
      }
      constraintses[j]=constraints;
    }
    while (true) {
      RolapStar.Measure distinctMeasure=getFirstDistinctMeasure(measuresList);
      if (distinctMeasure == null) {
        break;
      }
      final String expr=distinctMeasure.expression.getGenericExpression();
      final ArrayList distinctMeasuresList=new ArrayList();
      for (int i=0; i < measuresList.size(); ) {
        RolapStar.Measure measure=(RolapStar.Measure)measuresList.get(i);
        if (measure.aggregator.distinct && measure.expression.getGenericExpression().equals(expr)) {
          measuresList.remove(i);
          distinctMeasuresList.add(distinctMeasure);
        }
 else {
          i++;
        }
      }
      RolapStar.Measure[] measures=(RolapStar.Measure[])distinctMeasuresList.toArray(new RolapStar.Measure[0]);
      loadAggregation(measures,columns,constraintses,pinnedSegments);
    }
    final int measureCount=measuresList.size();
    if (measureCount > 0) {
      RolapStar.Measure[] measures=(RolapStar.Measure[])measuresList.toArray(new RolapStar.Measure[measureCount]);
      loadAggregation(measures,columns,constraintses,pinnedSegments);
    }
  }
}