Program: 96056
Project: 96056
Buggy source:
public static AggregateFrame fromDmbsQueryResult(DbmsQueryResult result,List<String> nonaggColumnsName,List<Pair<String,String>> aggColumns) throws ValueException {
  List<String> colName=new ArrayList<>();
  List<Integer> colIndex=new ArrayList<>();
  List<String> aggColumnsName=new ArrayList<>();
  for (  Pair<String,String> pair : aggColumns) {
    aggColumnsName.add(pair.getKey());
  }
  HashSet<String> aggColumnsSet=new HashSet<>(aggColumnsName);
  HashSet<String> nonaggColumnsSet=new HashSet<>(nonaggColumnsName);
  List<Integer> aggColumnIndex=new ArrayList<>();
  List<Integer> nonaggColumnIndex=new ArrayList<>();
  List<String> orderedAggColumnName=new ArrayList<>();
  List<String> orderedNonaggColumnName=new ArrayList<>();
  List<Integer> columnTypes=new ArrayList<>();
  for (int i=0; i < result.getColumnCount(); i++) {
    colName.add(result.getColumnName(i));
    columnTypes.add(result.getColumnType(i));
    if (aggColumnsSet.contains(result.getColumnName(i))) {
      orderedAggColumnName.add(result.getColumnName(i));
      aggColumnIndex.add(i);
    }
 else     if (nonaggColumnsSet.contains(result.getColumnName(i))) {
      orderedNonaggColumnName.add(result.getColumnName(i));
      nonaggColumnIndex.add(i);
    }
 else {
      throw new ValueException("String_Node_Str");
    }
  }
  AggregateFrame aggregateFrame=new AggregateFrame(colName);
  aggregateFrame.setColumnTypes(columnTypes);
  for (  String col : colName) {
    boolean find=false;
    for (int i=0; i < orderedNonaggColumnName.size(); i++) {
      if (col.equals(orderedNonaggColumnName.get(i))) {
        colIndex.add(i);
        find=true;
        break;
      }
    }
    if (find)     continue;
    for (int i=0; i < orderedAggColumnName.size(); i++) {
      if (col.equals(orderedAggColumnName.get(i))) {
        colIndex.add(i + orderedNonaggColumnName.size());
        break;
      }
    }
  }
  aggregateFrame.setOrderedColumnIndex(colIndex);
  while (result.next()) {
    List<Object> aggValue=new ArrayList<>();
    List<Object> nonaggValue=new ArrayList<>();
    for (    int i : aggColumnIndex) {
      aggValue.add(result.getValue(i));
    }
    for (    int i : nonaggColumnIndex) {
      nonaggValue.add(result.getValue(i));
    }
    aggregateFrame.addRow(new AggregateGroup(orderedNonaggColumnName,nonaggValue),new AggregateMeasures(orderedAggColumnName,aggValue));
  }
  return aggregateFrame;
}

Fixed version (ground truth):
public static AggregateFrame fromDmbsQueryResult(DbmsQueryResult result,List<String> nonaggColumnsName,List<Pair<String,String>> aggColumns) throws ValueException {
  List<String> colName=new ArrayList<>();
  List<String> aggColumnsName=new ArrayList<>();
  for (  Pair<String,String> pair : aggColumns) {
    aggColumnsName.add(pair.getKey());
  }
  HashSet<String> aggColumnsSet=new HashSet<>(aggColumnsName);
  HashSet<String> nonaggColumnsSet=new HashSet<>(nonaggColumnsName);
  List<Integer> aggColumnIndex=new ArrayList<>();
  List<Integer> nonaggColumnIndex=new ArrayList<>();
  List<String> orderedAggColumnName=new ArrayList<>();
  List<String> orderedNonaggColumnName=new ArrayList<>();
  List<Integer> columnTypes=new ArrayList<>();
  for (int i=0; i < result.getColumnCount(); i++) {
    colName.add(result.getColumnName(i));
    columnTypes.add(result.getColumnType(i));
    if (aggColumnsSet.contains(result.getColumnName(i))) {
      orderedAggColumnName.add(result.getColumnName(i));
      aggColumnIndex.add(i);
    }
 else     if (nonaggColumnsSet.contains(result.getColumnName(i))) {
      orderedNonaggColumnName.add(result.getColumnName(i));
      nonaggColumnIndex.add(i);
    }
 else {
      throw new ValueException("String_Node_Str");
    }
  }
  AggregateFrame aggregateFrame=new AggregateFrame(colName);
  aggregateFrame.setColumnTypes(columnTypes);
  while (result.next()) {
    List<Object> aggValue=new ArrayList<>();
    List<Object> nonaggValue=new ArrayList<>();
    for (    int i : aggColumnIndex) {
      aggValue.add(result.getValue(i));
    }
    for (    int i : nonaggColumnIndex) {
      nonaggValue.add(result.getValue(i));
    }
    aggregateFrame.addRow(new AggregateGroup(orderedNonaggColumnName,nonaggValue),new AggregateMeasures(orderedAggColumnName,aggValue));
  }
  return aggregateFrame;
}