Program: 108707
Project: 108707
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 || level == 0) {
    sort(list,datatype);
  }
 else {
    final Map<String,Integer> order=new HashMap<String,Integer>();
    int max=0;
    Set<String> baseSet=new HashSet<String>();
    DataType<?> baseType=handle.getBaseDataType(attribute);
    for (int i=0; i < _hierarchy.length; i++) {
      String element=_hierarchy[i][0];
      if (baseType.isValid(element))       baseSet.add(element);
    }
    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])) {
        Integer position=baseOrder.get(_hierarchy[i][0]);
        if (position != null) {
          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,handle.getSuppressionString());
  }
 else {
    final Map<String,Integer> order=new HashMap<String,Integer>();
    int max=0;
    Set<String> baseSet=new HashSet<String>();
    DataType<?> baseType=handle.getBaseDataType(attribute);
    for (int i=0; i < _hierarchy.length; i++) {
      String element=_hierarchy[i][0];
      if (baseType.isValid(element))       baseSet.add(element);
    }
    String[] baseArray=baseSet.toArray(new String[baseSet.size()]);
    sort(baseArray,handle.getBaseDataType(attribute),handle.getSuppressionString());
    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])) {
        Integer position=baseOrder.get(_hierarchy[i][0]);
        if (position != null) {
          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;
}