Program: 108804
Project: 108804
Buggy source:
/** 
 * Returns an order list of the distinct set of data items from the given column. This method assumes  that the order of string data items can (and should) be derived from the provided hierarchy
 * @param column The column
 * @param hierarchy The hierarchy, may be null
 * @return
 */
public String[] getDistinctValuesOrdered(int column,Hierarchy hierarchy){
  final String[] list=getDistinctValues(column);
  final String attribute=handle.getAttributeName(column);
  final DataType<?> datatype=handle.getDataType(attribute);
  final int level=handle.getGeneralization(attribute);
  final String[][] _hierarchy=hierarchy != null ? hierarchy.getHierarchy() : null;
  if (_hierarchy == null) {
    sort(list,datatype);
  }
 else {
    final Map<String,Integer> order=new HashMap<String,Integer>();
    int max=0;
    if (level == 0 || handle.getBaseDataType(attribute) instanceof ARXString) {
      for (int i=0; i < _hierarchy.length; i++) {
        if (!order.containsKey(_hierarchy[i][level])) {
          order.put(_hierarchy[i][level],order.size());
        }
      }
      max=order.size();
    }
 else {
      Set<String> baseSet=new HashSet<String>();
      for (int i=0; i < _hierarchy.length; i++) {
        baseSet.add(_hierarchy[i][0]);
      }
      String[] baseArray=baseSet.toArray(new String[baseSet.size()]);
      sort(baseArray,handle.getBaseDataType(attribute));
      Map<String,Integer> baseOrder=new HashMap<String,Integer>();
      for (int i=0; i < baseArray.length; i++) {
        baseOrder.put(baseArray[i],i);
      }
      for (int i=0; i < _hierarchy.length; i++) {
        if (!order.containsKey(_hierarchy[i][level])) {
          int position=baseOrder.get(_hierarchy[i][0]);
          order.put(_hierarchy[i][level],position);
          max=Math.max(position,max) + 1;
        }
      }
    }
    String supp=handle.getSuppressionString();
    if (supp != null)     order.put(supp,max);
    sort(list,order);
  }
  return list;
}

Fixed version (ground truth):
/** 
 * Returns an order list of the distinct set of data items from the given column. This method assumes  that the order of string data items can (and should) be derived from the provided hierarchy
 * @param column The column
 * @param hierarchy The hierarchy, may be null
 * @return
 */
public String[] getDistinctValuesOrdered(int column,Hierarchy hierarchy){
  final String[] list=getDistinctValues(column);
  final String attribute=handle.getAttributeName(column);
  final DataType<?> datatype=handle.getDataType(attribute);
  final int level=handle.getGeneralization(attribute);
  final String[][] _hierarchy=hierarchy != null ? hierarchy.getHierarchy() : null;
  if (_hierarchy == null || level == 0) {
    sort(list,datatype);
  }
 else {
    final Map<String,Integer> order=new HashMap<String,Integer>();
    int max=0;
    Set<String> baseSet=new HashSet<String>();
    for (int i=0; i < _hierarchy.length; i++) {
      baseSet.add(_hierarchy[i][0]);
    }
    String[] baseArray=baseSet.toArray(new String[baseSet.size()]);
    sort(baseArray,handle.getBaseDataType(attribute));
    Map<String,Integer> baseOrder=new HashMap<String,Integer>();
    for (int i=0; i < baseArray.length; i++) {
      baseOrder.put(baseArray[i],i);
    }
    for (int i=0; i < _hierarchy.length; i++) {
      if (!order.containsKey(_hierarchy[i][level])) {
        int position=baseOrder.get(_hierarchy[i][0]);
        order.put(_hierarchy[i][level],position);
        max=Math.max(position,max) + 1;
      }
    }
    String supp=handle.getSuppressionString();
    if (supp != null)     order.put(supp,max);
    sort(list,order);
  }
  return list;
}