Program: 108909
Project: 108909
Buggy source:
/** 
 * Returns the labels sorted per hierarchy or per data type
 * @param attribute
 * @return
 */
private String[] getLabels(final String attribute){
  ModelConfiguration config=model.getOutputConfig();
  if (config == null) {
    config=model.getInputConfig();
  }
  final AttributeType type=config.getInput().getDefinition().getAttributeType(attribute);
  Hierarchy hierarchy=null;
  if (type instanceof Hierarchy) {
    hierarchy=(Hierarchy)type;
  }
 else   if (type == AttributeType.SENSITIVE_ATTRIBUTE) {
    hierarchy=config.getHierarchy(attribute);
  }
  final int index=handle.getColumnIndexOf(attribute);
  final Set<String> elems=new HashSet<String>();
  for (int i=0; i < handle.getNumRows(); i++) {
    elems.add(handle.getValue(i,index));
  }
  final String[] dvals;
  if (hierarchy != null && hierarchy.getHierarchy() != null && hierarchy.getHierarchy().length != 0) {
    final int level=handle.getGeneralization(attribute);
    final List<String> list=new ArrayList<String>();
    final Set<String> done=new HashSet<String>();
    final String[][] h=hierarchy.getHierarchy();
    for (int i=0; i < h.length; i++) {
      final String val=h[i][level];
      if (elems.contains(val) && !done.contains(val)) {
        list.add(val);
        done.add(val);
      }
    }
    if (model.getAnonymizer() != null && elems.contains(model.getAnonymizer().getSuppressionString()) && !done.contains(model.getAnonymizer().getSuppressionString())) {
      list.add(model.getAnonymizer().getSuppressionString());
    }
    dvals=list.toArray(new String[]{});
  }
 else {
    final DataType<?> dtype=handle.getDataType(attribute);
    final String[] v=new String[elems.size()];
    int i=0;
    for (    final String s : elems) {
      v[i++]=s;
    }
    Arrays.sort(v,new Comparator<String>(){
      @Override public int compare(      final String arg0,      final String arg1){
        try {
          return dtype.compare(arg0,arg1);
        }
 catch (        final Exception e) {
          throw new RuntimeException(e);
        }
      }
    }
);
    dvals=v;
  }
  return dvals;
}

Fixed version (ground truth):
/** 
 * Returns the labels sorted per hierarchy or per data type
 * @param attribute
 * @return
 */
private String[] getLabels(final String attribute){
  ModelConfiguration config=model.getOutputConfig();
  if (config == null) {
    config=model.getInputConfig();
  }
  final AttributeType type=config.getInput().getDefinition().getAttributeType(attribute);
  Hierarchy hierarchy=null;
  if (type instanceof Hierarchy) {
    hierarchy=(Hierarchy)type;
  }
 else   if (type == AttributeType.SENSITIVE_ATTRIBUTE) {
    hierarchy=config.getHierarchy(attribute);
  }
  final int index=handle.getColumnIndexOf(attribute);
  final Set<String> elems=new HashSet<String>();
  for (int i=0; i < handle.getNumRows(); i++) {
    elems.add(handle.getValue(i,index));
  }
  final String[] dvals;
  if (hierarchy != null && hierarchy.getHierarchy() != null && hierarchy.getHierarchy().length != 0) {
    final int level=handle.getGeneralization(attribute);
    final List<String> list=new ArrayList<String>();
    final Set<String> done=new HashSet<String>();
    final String[][] h=hierarchy.getHierarchy();
    for (int i=0; i < h.length; i++) {
      final String val=h[i][level];
      if (elems.contains(val) && !done.contains(val)) {
        list.add(val);
        done.add(val);
      }
    }
    if (model.getAnonymizer() != null && elems.contains(model.getAnonymizer().getSuppressionString()) && !done.contains(model.getAnonymizer().getSuppressionString())) {
      list.add(model.getAnonymizer().getSuppressionString());
    }
    dvals=list.toArray(new String[]{});
  }
 else {
    final DataType<?> dtype=handle.getDataType(attribute);
    final String[] v=new String[elems.size()];
    int i=0;
    for (    final String s : elems) {
      v[i++]=s;
    }
    try {
      Arrays.sort(v,new Comparator<String>(){
        @Override public int compare(        final String arg0,        final String arg1){
          try {
            return dtype.compare(arg0,arg1);
          }
 catch (          final Exception e) {
            throw new RuntimeException(e);
          }
        }
      }
);
    }
 catch (    Exception e) {
      controller.getResources().getLogger().warn("String_Node_Str");
    }
    dvals=v;
  }
  return dvals;
}