Program: 70178
Project: 70178
Buggy source:
public IAggregationResultSet execute(StopSign stopSign) throws IOException, DataException {
  AggregationResultRowComparator comparator=new AggregationResultRowComparator(keyLevelIndex);
  SortedAggregationRowArray sortedRows=new SortedAggregationRowArray(aggrResultSet,aggregation.getLevels());
  IDiskArray result=new BufferedStructureArray(AggregationResultRow.getCreator(),Constants.LIST_BUFFER_SIZE);
  if (aggrResultSet.length() <= 0) {
    return getAggregationResultSet(result);
  }
  IAggregationResultRow lastRow=sortedRows.get(0);
  IAggregationResultRow currentRow=null;
  AggregationResultRow resultRow=newAggregationResultRow(lastRow);
  if (accumulators != null) {
    for (int i=0; i < accumulators.length; i++) {
      accumulators[i].start();
    }
  }
  onRow(lastRow);
  for (int i=1; !stopSign.isStopped() && i < sortedRows.size(); i++) {
    currentRow=sortedRows.get(i);
    if (comparator.compare(currentRow,lastRow) != 0) {
      if (accumulators != null) {
        for (int j=0; j < accumulators.length; j++) {
          accumulators[j].finish();
          resultRow.getAggregationValues()[j]=accumulators[j].getValue();
          accumulators[j].start();
        }
      }
      result.add(resultRow);
      resultRow=newAggregationResultRow(currentRow);
    }
    onRow(currentRow);
    lastRow=currentRow;
  }
  if (accumulators != null) {
    for (int j=0; j < accumulators.length; j++) {
      accumulators[j].finish();
      resultRow.getAggregationValues()[j]=accumulators[j].getValue();
    }
  }
  result.add(resultRow);
  return getAggregationResultSet(result);
}

Fixed version (ground truth):
public IAggregationResultSet execute(StopSign stopSign) throws IOException, DataException {
  AggregationResultRowComparator comparator=null;
  if (keyLevelIndex != null) {
    comparator=new AggregationResultRowComparator(keyLevelIndex);
  }
  SortedAggregationRowArray sortedRows=new SortedAggregationRowArray(aggrResultSet,aggregation.getLevels());
  IDiskArray result=new BufferedStructureArray(AggregationResultRow.getCreator(),Constants.LIST_BUFFER_SIZE);
  if (aggrResultSet.length() <= 0) {
    return getAggregationResultSet(result);
  }
  IAggregationResultRow lastRow=sortedRows.get(0);
  IAggregationResultRow currentRow=null;
  AggregationResultRow resultRow=newAggregationResultRow(lastRow);
  if (accumulators != null) {
    for (int i=0; i < accumulators.length; i++) {
      accumulators[i].start();
    }
  }
  onRow(lastRow);
  for (int i=1; !stopSign.isStopped() && i < sortedRows.size(); i++) {
    currentRow=sortedRows.get(i);
    if (comparator != null && comparator.compare(currentRow,lastRow) != 0) {
      if (accumulators != null) {
        for (int j=0; j < accumulators.length; j++) {
          accumulators[j].finish();
          resultRow.getAggregationValues()[j]=accumulators[j].getValue();
          accumulators[j].start();
        }
      }
      result.add(resultRow);
      resultRow=newAggregationResultRow(currentRow);
    }
    onRow(currentRow);
    lastRow=currentRow;
  }
  if (accumulators != null) {
    for (int j=0; j < accumulators.length; j++) {
      accumulators[j].finish();
      resultRow.getAggregationValues()[j]=accumulators[j].getValue();
    }
  }
  result.add(resultRow);
  return getAggregationResultSet(result);
}