Program: 186726
Project: 186726
Buggy source:
/** 
 * Copy an existing node, and replace the callstring of the node with a new callstring. All reachable nodes are also copied using the new callstring if they do not exist.
 * @param source the node to copy
 * @param newContext the new callstring for the new node
 * @param callstringLength the maximum callstring length for new nodes.
 * @return the new node
 */
public ExecutionContext copyNodeRecursive(ExecutionContext source,CallString newContext,int callstringLength){
  ExecutionContext root=new ExecutionContext(source.getMethodInfo(),newContext);
  if (callGraph.containsVertex(root)) {
    return root;
  }
  callGraph.addVertex(root);
  List<ExecutionContext> newQueue=new LinkedList<ExecutionContext>();
  List<ExecutionContext> oldQueue=new LinkedList<ExecutionContext>();
  oldQueue.add(source);
  newQueue.add(root);
  while (!newQueue.isEmpty()) {
    ExecutionContext newNode=newQueue.remove(0);
    ExecutionContext oldNode=oldQueue.remove(0);
    for (    ExecutionContext oldChild : getChildren(oldNode)) {
      CallString newString;
      if (oldChild.getCallString().isEmpty()) {
        newString=CallString.EMPTY;
      }
 else {
        newString=newNode.getCallString().push(oldChild.getCallString().top(),callstringLength);
      }
      ExecutionContext newChild=new ExecutionContext(oldChild.getMethodInfo(),newString);
      if (!callGraph.containsVertex(newChild)) {
        oldQueue.add(oldChild);
        newQueue.add(newChild);
      }
      callGraph.addEdge(newNode,newChild);
    }
  }
  return root;
}

Fixed version (ground truth):
/** 
 * Copy an existing node, and replace the callstring of the node with a new callstring. All reachable nodes are also copied using the new callstring if they do not exist.
 * @param source the node to copy
 * @param newContext the new callstring for the new node
 * @param callstringLength the maximum callstring length for new nodes.
 * @return the new node
 */
public ExecutionContext copyNodeRecursive(ExecutionContext source,CallString newContext,int callstringLength){
  ExecutionContext root=new ExecutionContext(source.getMethodInfo(),newContext);
  if (callGraph.containsVertex(root)) {
    return root;
  }
  callGraph.addVertex(root);
  List<ExecutionContext> newQueue=new LinkedList<ExecutionContext>();
  List<ExecutionContext> oldQueue=new LinkedList<ExecutionContext>();
  oldQueue.add(source);
  newQueue.add(root);
  while (!newQueue.isEmpty()) {
    ExecutionContext newNode=newQueue.remove(0);
    ExecutionContext oldNode=oldQueue.remove(0);
    for (    ExecutionContext oldChild : getChildren(oldNode)) {
      CallString newString;
      if (oldChild.getCallString().isEmpty()) {
        newString=CallString.EMPTY;
      }
 else {
        newString=newNode.getCallString().push(oldChild.getCallString().top(),callstringLength);
      }
      ExecutionContext newChild=new ExecutionContext(oldChild.getMethodInfo(),newString);
      if (!callGraph.containsVertex(newChild)) {
        callGraph.addVertex(newChild);
        oldQueue.add(oldChild);
        newQueue.add(newChild);
      }
      callGraph.addEdge(newNode,newChild);
    }
  }
  return root;
}