Program: 12150
Project: 12150
Buggy source:
private List<CFGNode> process(List<CFGNode> previousNodes,CompositeStatementObject composite){
  int i=0;
  for (  AbstractStatement abstractStatement : composite.getStatements()) {
    if (abstractStatement instanceof StatementObject) {
      StatementObject statement=(StatementObject)abstractStatement;
      previousNodes=processNonCompositeStatement(previousNodes,statement);
    }
 else     if (abstractStatement instanceof CompositeStatementObject) {
      CompositeStatementObject compositeStatement=(CompositeStatementObject)abstractStatement;
      if (compositeStatement.getStatement() instanceof Block) {
        previousNodes=process(previousNodes,compositeStatement);
      }
 else       if (compositeStatement.getStatement() instanceof TryStatement) {
        AbstractStatement firstStatement=compositeStatement.getStatements().get(0);
        if (firstStatement instanceof StatementObject) {
          previousNodes=processNonCompositeStatement(previousNodes,(StatementObject)firstStatement);
        }
 else         if (firstStatement instanceof CompositeStatementObject) {
          previousNodes=process(previousNodes,(CompositeStatementObject)firstStatement);
        }
      }
 else       if (isLoop(compositeStatement)) {
        CFGBranchNode currentNode=new CFGBranchLoopNode(compositeStatement);
        nodes.add(currentNode);
        createTopDownFlow(previousNodes,currentNode);
        previousNodes=new ArrayList<CFGNode>();
        ArrayList<CFGNode> currentNodes=new ArrayList<CFGNode>();
        currentNodes.add(currentNode);
        previousNodes.addAll(process(currentNodes,compositeStatement));
        for (        CFGNode previousNode : previousNodes) {
          Flow flow=new Flow(previousNode,currentNode);
          if (previousNode instanceof CFGBranchNode) {
            flow.setFalseControlFlow(true);
          }
          flow.setLoopbackFlow(true);
          edges.add(flow);
        }
        if (previousNodes.size() > 1) {
          List<CFGBranchConditionalNode> conditionalNodes=unjoinedConditionalNodes.pop();
          for (          CFGBranchConditionalNode conditionalNode : conditionalNodes) {
            conditionalNode.setJoinNode(currentNode);
          }
        }
        previousNodes=currentNodes;
      }
 else       if (compositeStatement.getStatement() instanceof DoStatement) {
        List<CFGNode> tmpNodes=previousNodes;
        previousNodes=process(previousNodes,compositeStatement);
        CFGBranchNode currentNode=new CFGBranchDoLoopNode(compositeStatement);
        nodes.add(currentNode);
        createTopDownFlow(previousNodes,currentNode);
        CFGNode topNode=getCommonNextNode(tmpNodes);
        Flow flow=new Flow(currentNode,topNode);
        flow.setTrueControlFlow(true);
        flow.setLoopbackFlow(true);
        edges.add(flow);
        ArrayList<CFGNode> currentNodes=new ArrayList<CFGNode>();
        currentNodes.add(currentNode);
        previousNodes=currentNodes;
      }
 else       if (compositeStatement.getStatement() instanceof IfStatement) {
        int action=PUSH_NEW_LIST;
        List<AbstractStatement> statements=composite.getStatements();
        CompositeStatementObject parent=statements.get(0).getParent();
        if (parent.getStatement() instanceof Block)         parent=parent.getParent();
        if (statements.size() == 1) {
          action=JOIN_TOP_LIST;
          if (parent != null) {
            if (isLoop(parent))             action=PUSH_NEW_LIST;
 else             if (parent.getStatement() instanceof DoStatement)             action=PLACE_NEW_LIST_SECOND_FROM_TOP;
          }
        }
 else         if (statements.size() > 1) {
          AbstractStatement previousStatement=null;
          if (i >= 1)           previousStatement=statements.get(i - 1);
          if (statements.get(statements.size() - 1).equals(compositeStatement)) {
            if (previousStatement != null && previousStatement.getStatement() instanceof IfStatement) {
              action=JOIN_SECOND_FROM_TOP_LIST;
              if (parent != null && (isLoop(parent) || parent.getStatement() instanceof DoStatement))               action=PLACE_NEW_LIST_SECOND_FROM_TOP;
            }
 else {
              action=JOIN_TOP_LIST;
              if (parent != null && (isLoop(parent) || parent.getStatement() instanceof DoStatement))               action=PUSH_NEW_LIST;
            }
          }
 else {
            if (previousStatement != null && previousStatement.getStatement() instanceof IfStatement)             action=PLACE_NEW_LIST_SECOND_FROM_TOP;
 else {
              action=PUSH_NEW_LIST;
              if (parent != null && parent.getStatement() instanceof DoStatement && statements.get(0).getStatement() instanceof IfStatement)               action=PLACE_NEW_LIST_SECOND_FROM_TOP;
            }
          }
        }
        previousNodes=processIfStatement(previousNodes,compositeStatement,action);
      }
    }
    i++;
  }
  return previousNodes;
}

Fixed version (ground truth):
private List<CFGNode> process(List<CFGNode> previousNodes,CompositeStatementObject composite){
  int i=0;
  for (  AbstractStatement abstractStatement : composite.getStatements()) {
    if (abstractStatement instanceof StatementObject) {
      StatementObject statement=(StatementObject)abstractStatement;
      previousNodes=processNonCompositeStatement(previousNodes,statement);
    }
 else     if (abstractStatement instanceof CompositeStatementObject) {
      CompositeStatementObject compositeStatement=(CompositeStatementObject)abstractStatement;
      if (compositeStatement.getStatement() instanceof Block) {
        previousNodes=process(previousNodes,compositeStatement);
      }
 else       if (compositeStatement.getStatement() instanceof TryStatement) {
        AbstractStatement firstStatement=compositeStatement.getStatements().get(0);
        if (firstStatement instanceof CompositeStatementObject) {
          previousNodes=process(previousNodes,(CompositeStatementObject)firstStatement);
        }
      }
 else       if (isLoop(compositeStatement)) {
        CFGBranchNode currentNode=new CFGBranchLoopNode(compositeStatement);
        nodes.add(currentNode);
        createTopDownFlow(previousNodes,currentNode);
        previousNodes=new ArrayList<CFGNode>();
        ArrayList<CFGNode> currentNodes=new ArrayList<CFGNode>();
        currentNodes.add(currentNode);
        previousNodes.addAll(process(currentNodes,compositeStatement));
        for (        CFGNode previousNode : previousNodes) {
          Flow flow=new Flow(previousNode,currentNode);
          if (previousNode instanceof CFGBranchNode) {
            flow.setFalseControlFlow(true);
          }
          flow.setLoopbackFlow(true);
          edges.add(flow);
        }
        if (previousNodes.size() > 1) {
          List<CFGBranchConditionalNode> conditionalNodes=unjoinedConditionalNodes.pop();
          for (          CFGBranchConditionalNode conditionalNode : conditionalNodes) {
            conditionalNode.setJoinNode(currentNode);
          }
        }
        previousNodes=currentNodes;
      }
 else       if (compositeStatement.getStatement() instanceof DoStatement) {
        List<CFGNode> tmpNodes=previousNodes;
        previousNodes=process(previousNodes,compositeStatement);
        CFGBranchNode currentNode=new CFGBranchDoLoopNode(compositeStatement);
        nodes.add(currentNode);
        createTopDownFlow(previousNodes,currentNode);
        CFGNode topNode=getCommonNextNode(tmpNodes);
        Flow flow=new Flow(currentNode,topNode);
        flow.setTrueControlFlow(true);
        flow.setLoopbackFlow(true);
        edges.add(flow);
        ArrayList<CFGNode> currentNodes=new ArrayList<CFGNode>();
        currentNodes.add(currentNode);
        previousNodes=currentNodes;
      }
 else       if (compositeStatement.getStatement() instanceof IfStatement) {
        int action=PUSH_NEW_LIST;
        List<AbstractStatement> statements=new ArrayList<AbstractStatement>(composite.getStatements());
        CompositeStatementObject parent=statements.get(0).getParent();
        if (parent.getStatement() instanceof Block)         parent=parent.getParent();
        int position=i;
        if (parent != null && parent.getStatement() instanceof TryStatement) {
          CompositeStatementObject tryStatement=parent;
          CompositeStatementObject tryStatementParent=tryStatement.getParent();
          List<AbstractStatement> tryParentStatements=new ArrayList<AbstractStatement>(tryStatementParent.getStatements());
          if (tryStatementParent.getStatement() instanceof Block)           tryStatementParent=tryStatementParent.getParent();
          int positionOfTryStatementInParent=0;
          int j=0;
          for (          AbstractStatement statement : tryParentStatements) {
            if (statement.equals(tryStatement)) {
              positionOfTryStatementInParent=j;
              break;
            }
            j++;
          }
          tryParentStatements.remove(tryStatement);
          tryParentStatements.addAll(positionOfTryStatementInParent,statements);
          statements=tryParentStatements;
          parent=tryStatementParent;
          position=positionOfTryStatementInParent + i;
        }
        if (statements.size() == 1) {
          action=JOIN_TOP_LIST;
          if (parent != null) {
            if (isLoop(parent))             action=PUSH_NEW_LIST;
 else             if (parent.getStatement() instanceof DoStatement)             action=PLACE_NEW_LIST_SECOND_FROM_TOP;
          }
        }
 else         if (statements.size() > 1) {
          AbstractStatement previousStatement=null;
          if (position >= 1)           previousStatement=statements.get(position - 1);
          if (previousStatement != null && previousStatement.getStatement() instanceof TryStatement) {
            CompositeStatementObject tryStatement=(CompositeStatementObject)previousStatement;
            AbstractStatement firstStatement=tryStatement.getStatements().get(0);
            if (firstStatement instanceof CompositeStatementObject) {
              CompositeStatementObject tryBlock=(CompositeStatementObject)firstStatement;
              List<AbstractStatement> tryBlockStatements=tryBlock.getStatements();
              if (tryBlockStatements.size() > 0) {
                previousStatement=tryBlockStatements.get(tryBlockStatements.size() - 1);
              }
 else {
                if (position >= 2)                 previousStatement=statements.get(position - 2);
 else                 previousStatement=null;
              }
            }
          }
          if (statements.get(statements.size() - 1).equals(compositeStatement)) {
            if (previousStatement != null && previousStatement.getStatement() instanceof IfStatement) {
              action=JOIN_SECOND_FROM_TOP_LIST;
              if (parent != null && (isLoop(parent) || parent.getStatement() instanceof DoStatement))               action=PLACE_NEW_LIST_SECOND_FROM_TOP;
            }
 else {
              action=JOIN_TOP_LIST;
              if (parent != null && (isLoop(parent) || parent.getStatement() instanceof DoStatement))               action=PUSH_NEW_LIST;
            }
          }
 else {
            if (previousStatement != null && previousStatement.getStatement() instanceof IfStatement)             action=PLACE_NEW_LIST_SECOND_FROM_TOP;
 else {
              action=PUSH_NEW_LIST;
              if (parent != null && parent.getStatement() instanceof DoStatement && statements.get(0).getStatement() instanceof IfStatement)               action=PLACE_NEW_LIST_SECOND_FROM_TOP;
            }
          }
        }
        previousNodes=processIfStatement(previousNodes,compositeStatement,action);
      }
    }
    i++;
  }
  return previousNodes;
}