Program: 12170
Project: 12170
Buggy source:
public Set<CFGNode> getImmediatelyNestedNodesFromAST(){
  Set<CFGNode> nestedNodes=new LinkedHashSet<CFGNode>();
  AbstractStatement abstractStatement=getStatement();
  if (abstractStatement instanceof CompositeStatementObject) {
    Set<AbstractStatement> nestedStatements=new LinkedHashSet<AbstractStatement>();
    CompositeStatementObject composite=(CompositeStatementObject)abstractStatement;
    List<AbstractStatement> statements=composite.getStatements();
    for (    AbstractStatement statement : statements) {
      if (statement.getStatement() instanceof Block) {
        CompositeStatementObject blockStatement=(CompositeStatementObject)statement;
        nestedStatements.addAll(blockStatement.getStatements());
      }
 else       nestedStatements.add(statement);
    }
    List<BasicBlock> nestedBasicBlocks=getNestedBasicBlocks();
    if (this instanceof CFGBranchDoLoopNode)     nestedBasicBlocks.add(getBasicBlock());
 else     nestedBasicBlocks.add(0,getBasicBlock());
    for (    BasicBlock nestedBlock : nestedBasicBlocks) {
      List<CFGNode> nodes=nestedBlock.getAllNodes();
      for (      CFGNode node : nodes) {
        if (nestedStatements.contains(node.getStatement())) {
          nestedNodes.add(node);
        }
      }
    }
  }
  return nestedNodes;
}

Fixed version (ground truth):
public Set<CFGNode> getImmediatelyNestedNodesFromAST(){
  Set<CFGNode> nestedNodes=new LinkedHashSet<CFGNode>();
  AbstractStatement abstractStatement=getStatement();
  if (abstractStatement instanceof CompositeStatementObject) {
    Set<AbstractStatement> nestedStatements=new LinkedHashSet<AbstractStatement>();
    CompositeStatementObject composite=(CompositeStatementObject)abstractStatement;
    List<AbstractStatement> statements=composite.getStatements();
    for (    AbstractStatement statement : statements) {
      if (statement.getStatement() instanceof Block) {
        CompositeStatementObject blockStatement=(CompositeStatementObject)statement;
        for (        AbstractStatement statementInsideBlock : blockStatement.getStatements()) {
          if (statementInsideBlock.getStatement() instanceof TryStatement) {
            CompositeStatementObject tryStatement=(CompositeStatementObject)statementInsideBlock;
            processTryStatement(nestedStatements,tryStatement);
          }
 else           nestedStatements.add(statementInsideBlock);
        }
      }
 else       if (statement.getStatement() instanceof TryStatement) {
        CompositeStatementObject tryStatement=(CompositeStatementObject)statement;
        processTryStatement(nestedStatements,tryStatement);
      }
 else       nestedStatements.add(statement);
    }
    List<BasicBlock> nestedBasicBlocks=getNestedBasicBlocks();
    if (this instanceof CFGBranchDoLoopNode)     nestedBasicBlocks.add(getBasicBlock());
 else     nestedBasicBlocks.add(0,getBasicBlock());
    for (    BasicBlock nestedBlock : nestedBasicBlocks) {
      List<CFGNode> nodes=nestedBlock.getAllNodes();
      for (      CFGNode node : nodes) {
        if (nestedStatements.contains(node.getStatement())) {
          nestedNodes.add(node);
        }
      }
    }
  }
  return nestedNodes;
}