Program: 55663
Project: 55663
Buggy source:
/** 
 * Copy constructor to create a copy of a node with different predecessors. The predecessors is assumed to be of the same type as in the template node and merely copies with different strategies, as they are created in the process of the plan enumeration.
 * @param template The node to create a copy of.
 * @param pred1 The new predecessor for the first input.
 * @param pred2 The new predecessor for the second input.
 * @param conn1 The old connection of the first input to copy properties from.
 * @param conn2 The old connection of the second input to copy properties from.
 * @param globalProps The global properties of this copy.
 * @param localProps The local properties of this copy.
 */
protected TwoInputNode(TwoInputNode template,List<OptimizerNode> pred1,List<OptimizerNode> pred2,List<PactConnection> conn1,List<PactConnection> conn2,GlobalProperties globalProps,LocalProperties localProps){
  super(template,globalProps,localProps);
  this.inputs=new ArrayList<List<PactConnection>>(2);
  int i=0;
  if (pred1 != null) {
    for (    PactConnection c : conn1) {
      PactConnection cc=new PactConnection(c,pred1.get(i++),this);
      this.input1.add(cc);
    }
    this.inputs.add(this.input1);
  }
  if (pred2 != null) {
    i=0;
    for (    PactConnection c : conn2) {
      PactConnection cc=new PactConnection(c,pred2.get(i++),this);
      this.input2.add(cc);
    }
    this.inputs.add(this.input2);
  }
  if (template.openBranches != null) {
    if (this.branchPlan == null) {
      this.branchPlan=new HashMap<OptimizerNode,OptimizerNode>(8);
    }
    for (    UnclosedBranchDescriptor uc : template.openBranches) {
      OptimizerNode brancher=uc.branchingNode;
      OptimizerNode selectedCandidate=null;
      if (pred1 != null) {
        Iterator<OptimizerNode> it1=pred1.iterator();
        while (it1.hasNext()) {
          OptimizerNode n=it1.next();
          if (n.branchPlan != null) {
            selectedCandidate=n.branchPlan.get(brancher);
            this.branchPlan.put(brancher,selectedCandidate);
          }
        }
      }
      if (selectedCandidate == null && pred2 != null) {
        Iterator<OptimizerNode> it2=pred2.iterator();
        while (it2.hasNext()) {
          OptimizerNode n=it2.next();
          if (n.branchPlan != null) {
            selectedCandidate=n.branchPlan.get(brancher);
            this.branchPlan.put(brancher,selectedCandidate);
          }
        }
      }
      if (selectedCandidate == null) {
        throw new CompilerException("String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Copy constructor to create a copy of a node with different predecessors. The predecessors is assumed to be of the same type as in the template node and merely copies with different strategies, as they are created in the process of the plan enumeration.
 * @param template The node to create a copy of.
 * @param pred1 The new predecessor for the first input.
 * @param pred2 The new predecessor for the second input.
 * @param conn1 The old connection of the first input to copy properties from.
 * @param conn2 The old connection of the second input to copy properties from.
 * @param globalProps The global properties of this copy.
 * @param localProps The local properties of this copy.
 */
protected TwoInputNode(TwoInputNode template,List<OptimizerNode> pred1,List<OptimizerNode> pred2,List<PactConnection> conn1,List<PactConnection> conn2,GlobalProperties globalProps,LocalProperties localProps){
  super(template,globalProps,localProps);
  int i=0;
  if (pred1 != null) {
    for (    PactConnection c : conn1) {
      PactConnection cc=new PactConnection(c,pred1.get(i++),this);
      this.input1.add(cc);
    }
  }
  if (pred2 != null) {
    i=0;
    for (    PactConnection c : conn2) {
      PactConnection cc=new PactConnection(c,pred2.get(i++),this);
      this.input2.add(cc);
    }
  }
  if (template.openBranches != null) {
    if (this.branchPlan == null) {
      this.branchPlan=new HashMap<OptimizerNode,OptimizerNode>(8);
    }
    for (    UnclosedBranchDescriptor uc : template.openBranches) {
      OptimizerNode brancher=uc.branchingNode;
      OptimizerNode selectedCandidate=null;
      if (pred1 != null) {
        Iterator<OptimizerNode> it1=pred1.iterator();
        while (it1.hasNext()) {
          OptimizerNode n=it1.next();
          if (n.branchPlan != null) {
            selectedCandidate=n.branchPlan.get(brancher);
            this.branchPlan.put(brancher,selectedCandidate);
          }
        }
      }
      if (selectedCandidate == null && pred2 != null) {
        Iterator<OptimizerNode> it2=pred2.iterator();
        while (it2.hasNext()) {
          OptimizerNode n=it2.next();
          if (n.branchPlan != null) {
            selectedCandidate=n.branchPlan.get(brancher);
            this.branchPlan.put(brancher,selectedCandidate);
          }
        }
      }
      if (selectedCandidate == null) {
        throw new CompilerException("String_Node_Str");
      }
    }
  }
}