Program: 108559
Project: 108559
Buggy source:
@SuppressWarnings("String_Node_Str") @Override protected AbstractGroup[][] prepareGroups(){
  if (comparator != null) {
    Arrays.sort(super.getData(),comparator);
  }
  List<Group<T>> groups=super.getLevel(0).getGroups();
  List<String> items=new ArrayList<String>();
  String[] data=getData();
  List<AbstractGroup[]> result=new ArrayList<AbstractGroup[]>();
  int index=0;
  int resultIndex=0;
  int groupCount=0;
  if (!super.getLevels().isEmpty() && !super.getLevel(0).getGroups().isEmpty()) {
    AbstractGroup[] first=new AbstractGroup[data.length];
    outer:     while (true) {
      for (      Group<T> group : groups) {
        for (int i=0; i < group.getSize(); i++) {
          items.add(data[index++]);
          if (index == data.length)           break;
        }
        CloseElements<T> element=new CloseElements<T>(items.toArray(new String[items.size()]),group.getFunction());
        for (int i=0; i < items.size(); i++) {
          first[resultIndex++]=element;
        }
        groupCount++;
        items.clear();
        if (index == data.length)         break outer;
      }
    }
    result.add(first);
    if (groupCount > 1) {
      for (int i=1; i < super.getLevels().size(); i++) {
        if (groupCount == 1)         break;
        groupCount=0;
        groups=super.getLevel(i).getGroups();
        Map<AbstractGroup,AbstractGroup> map=new HashMap<AbstractGroup,AbstractGroup>();
        List<AbstractGroup> list=new ArrayList<AbstractGroup>();
        AbstractGroup[] column=result.get(i - 1);
        for (int j=0; j < column.length; j++) {
          if (!map.containsKey(column[j])) {
            map.put(column[j],column[j]);
            list.add(column[j]);
          }
        }
        index=0;
        resultIndex=0;
        List<CloseElements<T>> gItems=new ArrayList<CloseElements<T>>();
        outer:         while (true) {
          for (          Group<T> group : groups) {
            for (int j=0; j < group.getSize(); j++) {
              gItems.add((CloseElements<T>)list.get(index++));
              if (index == list.size())               break;
            }
            CloseElements<T> element=gItems.get(0).merge(gItems,group.getFunction());
            groupCount++;
            for (int j=0; j < gItems.size(); j++) {
              map.put(gItems.get(j),element);
            }
            gItems.clear();
            if (index == list.size())             break outer;
          }
        }
        AbstractGroup[] ccolumn=new AbstractGroup[data.length];
        for (int j=0; j < column.length; j++) {
          ccolumn[j]=map.get(column[j]);
        }
        result.add(ccolumn);
      }
    }
  }
 else {
    groupCount=data.length;
  }
  if (groupCount > 1) {
    AbstractGroup[] column=new AbstractGroup[data.length];
    CloseElements<T> element=new CloseElements<T>(new String[]{},AggregateFunction.forType(getDataType()).createConstantFunction("String_Node_Str"));
    for (int i=0; i < column.length; i++) {
      column[i]=element;
    }
    result.add(column);
  }
  return result.toArray(new AbstractGroup[0][0]);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override protected AbstractGroup[][] prepareGroups(){
  if (comparator != null) {
    try {
      Arrays.sort(super.getData(),comparator);
    }
 catch (    Exception e) {
      throw new IllegalArgumentException(e.getMessage());
    }
  }
  List<Group<T>> groups=super.getLevel(0).getGroups();
  List<String> items=new ArrayList<String>();
  String[] data=getData();
  List<AbstractGroup[]> result=new ArrayList<AbstractGroup[]>();
  int index=0;
  int resultIndex=0;
  int groupCount=0;
  if (!super.getLevels().isEmpty() && !super.getLevel(0).getGroups().isEmpty()) {
    AbstractGroup[] first=new AbstractGroup[data.length];
    outer:     while (true) {
      for (      Group<T> group : groups) {
        for (int i=0; i < group.getSize(); i++) {
          items.add(data[index++]);
          if (index == data.length)           break;
        }
        CloseElements<T> element=new CloseElements<T>(items.toArray(new String[items.size()]),group.getFunction());
        for (int i=0; i < items.size(); i++) {
          first[resultIndex++]=element;
        }
        groupCount++;
        items.clear();
        if (index == data.length)         break outer;
      }
    }
    result.add(first);
    if (groupCount > 1) {
      for (int i=1; i < super.getLevels().size(); i++) {
        if (groupCount == 1)         break;
        groupCount=0;
        groups=super.getLevel(i).getGroups();
        Map<AbstractGroup,AbstractGroup> map=new HashMap<AbstractGroup,AbstractGroup>();
        List<AbstractGroup> list=new ArrayList<AbstractGroup>();
        AbstractGroup[] column=result.get(i - 1);
        for (int j=0; j < column.length; j++) {
          if (!map.containsKey(column[j])) {
            map.put(column[j],column[j]);
            list.add(column[j]);
          }
        }
        index=0;
        resultIndex=0;
        List<CloseElements<T>> gItems=new ArrayList<CloseElements<T>>();
        outer:         while (true) {
          for (          Group<T> group : groups) {
            for (int j=0; j < group.getSize(); j++) {
              gItems.add((CloseElements<T>)list.get(index++));
              if (index == list.size())               break;
            }
            CloseElements<T> element=gItems.get(0).merge(gItems,group.getFunction());
            groupCount++;
            for (int j=0; j < gItems.size(); j++) {
              map.put(gItems.get(j),element);
            }
            gItems.clear();
            if (index == list.size())             break outer;
          }
        }
        AbstractGroup[] ccolumn=new AbstractGroup[data.length];
        for (int j=0; j < column.length; j++) {
          ccolumn[j]=map.get(column[j]);
        }
        result.add(ccolumn);
      }
    }
  }
 else {
    groupCount=data.length;
  }
  if (groupCount > 1) {
    AbstractGroup[] column=new AbstractGroup[data.length];
    CloseElements<T> element=new CloseElements<T>(new String[]{},AggregateFunction.forType(getDataType()).createConstantFunction("String_Node_Str"));
    for (int i=0; i < column.length; i++) {
      column[i]=element;
    }
    result.add(column);
  }
  return result.toArray(new AbstractGroup[0][0]);
}