Program: 108107
Project: 108107
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);
  List<Long> neighbors=new ArrayList<Long>();
  for (Iterator<Long> iter=solutions.getPredecessors(transformation.getIdentifier()); iter.hasNext(); ) {
    neighbors.add(iter.next());
  }
  for (Iterator<Long> iter=solutions.getSuccessors(transformation.getIdentifier()); iter.hasNext(); ) {
    neighbors.add(iter.next());
  }
  Map<String,Integer> headermap=null;
  LongObjectOpenHashMap<ARXNode> map=new LongObjectOpenHashMap<ARXNode>();
  Set<Long> missing=new HashSet<Long>(neighbors);
  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);
    }
    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){
  if (this.isComplete()) {
    return;
  }
  int[] indices=center.getTransformation();
  Transformation transformation=solutions.getTransformation(indices);
  List<Long> neighbors=new ArrayList<Long>();
  for (Iterator<Long> iter=solutions.getPredecessors(transformation.getIdentifier()); iter.hasNext(); ) {
    neighbors.add(iter.next());
  }
  for (Iterator<Long> iter=solutions.getSuccessors(transformation.getIdentifier()); iter.hasNext(); ) {
    neighbors.add(iter.next());
  }
  Map<String,Integer> headermap=null;
  LongObjectOpenHashMap<ARXNode> map=new LongObjectOpenHashMap<ARXNode>();
  Set<Long> missing=new HashSet<Long>(neighbors);
  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();
}