Program: 107912
Project: 107912
Buggy source:
/** 
 * Materializes any non-materialized predecessors and successors
 */
public void expand(ARXNode center){
  if (this.isComplete()) {
    return;
  }
  int[] indices=center.getTransformation();
  Transformation transformation=solutions.getTransformation(indices);
  LongArrayList neighbors=transformation.getPredecessors();
  LongArrayList successors=transformation.getSuccessors();
  neighbors.addAllOfFromTo(successors,0,successors.size() - 1);
  Map<String,Integer> headermap=null;
  LongObjectOpenHashMap<ARXNode> map=new LongObjectOpenHashMap<ARXNode>();
  Set<Long> missing=new HashSet<Long>();
  for (int i=0; i < neighbors.size(); i++) {
    missing.add(neighbors.getQuick(i));
  }
  for (  ARXNode[] level : this.levels) {
    for (    ARXNode node : level) {
      headermap=headermap != null ? headermap : node.headermap;
      Long id=solutions.getTransformation(node.getTransformation()).getIdentifier();
      map.put(id,node);
      missing.remove(id);
    }
  }
  Map<Integer,List<ARXNode>> levels=new HashMap<Integer,List<ARXNode>>();
  for (  long id : missing) {
    transformation=solutions.getTransformation(id);
    ARXNode node=new ARXNode(this,solutions,transformation,headermap);
    map.put(id,node);
    if (!levels.containsKey(transformation.getLevel())) {
      levels.put(transformation.getLevel(),new ArrayList<ARXNode>());
    }
    levels.get(transformation.getLevel()).add(node);
  }
  for (  int level : levels.keySet()) {
    List<ARXNode> nodes=levels.get(level);
    Collections.sort(nodes,new Comparator<ARXNode>(){
      public int compare(      ARXNode o1,      ARXNode o2){
        return compareLexicographically(o1,o2);
      }
    }
);
    List<ARXNode> list=new ArrayList<ARXNode>();
    int index=0;
    for (    ARXNode node : this.levels[level]) {
      while (index < nodes.size() && compareLexicographically(nodes.get(index),node) < 0) {
        list.add(nodes.get(index++));
      }
      list.add(node);
    }
    while (index < nodes.size()) {
      list.add(nodes.get(index++));
    }
    this.levels[level]=list.toArray(new ARXNode[list.size()]);
  }
  for (  long id : missing) {
    this.createExpandedRelationships(solutions,map,id);
  }
  this.estimateInformationLoss();
}

Fixed version (ground truth):
/** 
 * Materializes any non-materialized predecessors and successors
 */
public void expand(ARXNode center){
  int[] indices=center.getTransformation();
  Transformation transformation=solutions.getTransformation(indices);
  LongArrayList neighbors=transformation.getPredecessors();
  LongArrayList successors=transformation.getSuccessors();
  neighbors.addAllOfFromTo(successors,0,successors.size() - 1);
  Map<String,Integer> headermap=null;
  LongObjectOpenHashMap<ARXNode> map=new LongObjectOpenHashMap<ARXNode>();
  Set<Long> missing=new HashSet<Long>();
  for (int i=0; i < neighbors.size(); i++) {
    missing.add(neighbors.getQuick(i));
  }
  for (  ARXNode[] level : this.levels) {
    for (    ARXNode node : level) {
      headermap=headermap != null ? headermap : node.headermap;
      Long id=solutions.getTransformation(node.getTransformation()).getIdentifier();
      map.put(id,node);
      missing.remove(id);
    }
  }
  Map<Integer,List<ARXNode>> levels=new HashMap<Integer,List<ARXNode>>();
  for (  long id : missing) {
    transformation=solutions.getTransformation(id);
    ARXNode node=new ARXNode(this,solutions,transformation,headermap);
    map.put(id,node);
    if (!levels.containsKey(transformation.getLevel())) {
      levels.put(transformation.getLevel(),new ArrayList<ARXNode>());
    }
    levels.get(transformation.getLevel()).add(node);
  }
  for (  int level : levels.keySet()) {
    List<ARXNode> nodes=levels.get(level);
    Collections.sort(nodes,new Comparator<ARXNode>(){
      public int compare(      ARXNode o1,      ARXNode o2){
        return compareLexicographically(o1,o2);
      }
    }
);
    List<ARXNode> list=new ArrayList<ARXNode>();
    int index=0;
    for (    ARXNode node : this.levels[level]) {
      while (index < nodes.size() && compareLexicographically(nodes.get(index),node) < 0) {
        list.add(nodes.get(index++));
      }
      list.add(node);
    }
    while (index < nodes.size()) {
      list.add(nodes.get(index++));
    }
    this.levels[level]=list.toArray(new ARXNode[list.size()]);
  }
  for (  long id : missing) {
    this.createExpandedRelationships(solutions,map,id);
  }
  if (!missing.isEmpty()) {
    this.estimateInformationLoss();
  }
}