Program: 12161
Project: 12161
Buggy source:
private List<CFGNode> processIfStatement(List<CFGNode> previousNodes,CompositeStatementObject compositeStatement){
  CFGBranchConditionalNode currentNode=new CFGBranchConditionalNode(compositeStatement);
  unjoinedConditionalNodes.add(currentNode);
  nodes.add(currentNode);
  createTopDownFlow(previousNodes,currentNode);
  previousNodes=new ArrayList<CFGNode>();
  List<AbstractStatement> ifStatementList=compositeStatement.getStatements();
  AbstractStatement thenClause=ifStatementList.get(0);
  if (thenClause instanceof StatementObject) {
    StatementObject thenClauseStatement=(StatementObject)thenClause;
    CFGNode thenClauseNode=new CFGNode(thenClauseStatement);
    nodes.add(thenClauseNode);
    ArrayList<CFGNode> currentNodes=new ArrayList<CFGNode>();
    currentNodes.add(currentNode);
    createTopDownFlow(currentNodes,thenClauseNode);
    previousNodes.add(thenClauseNode);
  }
 else   if (thenClause instanceof CompositeStatementObject) {
    CompositeStatementObject thenClauseCompositeStatement=(CompositeStatementObject)thenClause;
    ArrayList<CFGNode> currentNodes=new ArrayList<CFGNode>();
    currentNodes.add(currentNode);
    if (thenClauseCompositeStatement.getStatement() instanceof IfStatement)     previousNodes.addAll(processIfStatement(currentNodes,thenClauseCompositeStatement));
 else     previousNodes.addAll(process(currentNodes,thenClauseCompositeStatement));
  }
  if (ifStatementList.size() == 2) {
    AbstractStatement elseClause=ifStatementList.get(1);
    if (elseClause instanceof StatementObject) {
      StatementObject elseClauseStatement=(StatementObject)elseClause;
      CFGNode elseClauseNode=new CFGNode(elseClauseStatement);
      nodes.add(elseClauseNode);
      ArrayList<CFGNode> currentNodes=new ArrayList<CFGNode>();
      currentNodes.add(currentNode);
      createTopDownFlow(currentNodes,elseClauseNode);
      previousNodes.add(elseClauseNode);
    }
 else     if (elseClause instanceof CompositeStatementObject) {
      CompositeStatementObject elseClauseCompositeStatement=(CompositeStatementObject)elseClause;
      ArrayList<CFGNode> currentNodes=new ArrayList<CFGNode>();
      currentNodes.add(currentNode);
      if (elseClauseCompositeStatement.getStatement() instanceof IfStatement)       previousNodes.addAll(processIfStatement(currentNodes,elseClauseCompositeStatement));
 else       previousNodes.addAll(process(currentNodes,elseClauseCompositeStatement));
    }
  }
 else {
    previousNodes.add(currentNode);
  }
  return previousNodes;
}

Fixed version (ground truth):
private List<CFGNode> processIfStatement(List<CFGNode> previousNodes,CompositeStatementObject compositeStatement,int action){
  CFGBranchConditionalNode currentNode=new CFGBranchConditionalNode(compositeStatement);
  if (action == JOIN_TOP_LIST && !unjoinedConditionalNodes.empty()) {
    List<CFGBranchConditionalNode> topList=unjoinedConditionalNodes.peek();
    topList.add(currentNode);
  }
 else   if (action == JOIN_SECOND_FROM_TOP_LIST) {
    List<CFGBranchConditionalNode> list=unjoinedConditionalNodes.elementAt(unjoinedConditionalNodes.size() - 2);
    list.add(currentNode);
  }
 else   if (action == PLACE_NEW_LIST_SECOND_FROM_TOP) {
    List<CFGBranchConditionalNode> topList=unjoinedConditionalNodes.pop();
    List<CFGBranchConditionalNode> list=new ArrayList<CFGBranchConditionalNode>();
    list.add(currentNode);
    unjoinedConditionalNodes.push(list);
    unjoinedConditionalNodes.push(topList);
  }
 else {
    List<CFGBranchConditionalNode> list=new ArrayList<CFGBranchConditionalNode>();
    list.add(currentNode);
    unjoinedConditionalNodes.push(list);
  }
  nodes.add(currentNode);
  createTopDownFlow(previousNodes,currentNode);
  previousNodes=new ArrayList<CFGNode>();
  List<AbstractStatement> ifStatementList=compositeStatement.getStatements();
  AbstractStatement thenClause=ifStatementList.get(0);
  if (thenClause instanceof StatementObject) {
    StatementObject thenClauseStatement=(StatementObject)thenClause;
    CFGNode thenClauseNode=new CFGNode(thenClauseStatement);
    nodes.add(thenClauseNode);
    ArrayList<CFGNode> currentNodes=new ArrayList<CFGNode>();
    currentNodes.add(currentNode);
    createTopDownFlow(currentNodes,thenClauseNode);
    previousNodes.add(thenClauseNode);
  }
 else   if (thenClause instanceof CompositeStatementObject) {
    CompositeStatementObject thenClauseCompositeStatement=(CompositeStatementObject)thenClause;
    ArrayList<CFGNode> currentNodes=new ArrayList<CFGNode>();
    currentNodes.add(currentNode);
    if (thenClauseCompositeStatement.getStatement() instanceof IfStatement)     previousNodes.addAll(processIfStatement(currentNodes,thenClauseCompositeStatement,JOIN_TOP_LIST));
 else     previousNodes.addAll(process(currentNodes,thenClauseCompositeStatement));
  }
  if (ifStatementList.size() == 2) {
    AbstractStatement elseClause=ifStatementList.get(1);
    if (elseClause instanceof StatementObject) {
      StatementObject elseClauseStatement=(StatementObject)elseClause;
      CFGNode elseClauseNode=new CFGNode(elseClauseStatement);
      nodes.add(elseClauseNode);
      ArrayList<CFGNode> currentNodes=new ArrayList<CFGNode>();
      currentNodes.add(currentNode);
      createTopDownFlow(currentNodes,elseClauseNode);
      previousNodes.add(elseClauseNode);
    }
 else     if (elseClause instanceof CompositeStatementObject) {
      CompositeStatementObject elseClauseCompositeStatement=(CompositeStatementObject)elseClause;
      ArrayList<CFGNode> currentNodes=new ArrayList<CFGNode>();
      currentNodes.add(currentNode);
      if (elseClauseCompositeStatement.getStatement() instanceof IfStatement)       previousNodes.addAll(processIfStatement(currentNodes,elseClauseCompositeStatement,JOIN_TOP_LIST));
 else       previousNodes.addAll(process(currentNodes,elseClauseCompositeStatement));
    }
  }
 else {
    previousNodes.add(currentNode);
  }
  return previousNodes;
}