Program: 12237
Project: 12237
Buggy source:
public ASTExtractionBlock getASTExtractionBlock(){
  ASTExtractionBlock astExtractionBlock=new ASTExtractionBlock(extractionBlock.getExtractedMethodName(),getReturnVariableDeclarationFragment(),getReturnVariableDeclarationStatement(),getStatementsForExtraction(),getAllVariableDeclarationStatements(),extractionBlock.getAssignmentOperators());
  if (extractionBlock.getParentStatementForCopy() != null)   astExtractionBlock.setParentStatementForCopy(extractionBlock.getParentStatementForCopy().getStatement());
  for (  LocalVariableDeclarationObject lvdo : extractionBlock.getAdditionalRequiredVariableDeclarations()) {
    VariableDeclarationStatement variableDeclarationStatement=extractionBlock.getAdditionalRequiredVariableDeclarationStatement(lvdo);
    astExtractionBlock.addRequiredVariableDeclarationStatement(getVariableDeclarationFragment(lvdo,variableDeclarationStatement),variableDeclarationStatement);
  }
  return astExtractionBlock;
}

Fixed version (ground truth):
public ASTExtractionBlock getASTExtractionBlock(){
  List<VariableDeclarationStatement> allVariableDeclarationStatements=new ArrayList<VariableDeclarationStatement>();
  List<VariableDeclarationExpression> allVariableDeclarationExpressions=new ArrayList<VariableDeclarationExpression>();
  List<LocalVariableInstructionObject> discreteLocalVariableInstructions=new ArrayList<LocalVariableInstructionObject>();
  for (  AbstractStatement abstractStatement : extractionBlock.getStatementsForExtraction()) {
    List<LocalVariableInstructionObject> instructionList=abstractStatement.getLocalVariableInstructions();
    for (    LocalVariableInstructionObject instruction : instructionList) {
      if (!discreteLocalVariableInstructions.contains(instruction)) {
        discreteLocalVariableInstructions.add(instruction);
        VariableDeclarationStatement variableDeclarationStatement=sourceMethod.getMethodObject().getVariableDeclarationStatement(instruction.generateLocalVariableDeclaration());
        if (variableDeclarationStatement != null) {
          allVariableDeclarationStatements.add(variableDeclarationStatement);
        }
 else {
          VariableDeclarationExpression variableDeclarationExpression=sourceMethod.getMethodObject().getVariableDeclarationExpression(instruction.generateLocalVariableDeclaration());
          if (variableDeclarationExpression != null)           allVariableDeclarationExpressions.add(variableDeclarationExpression);
        }
      }
    }
  }
  ASTExtractionBlock astExtractionBlock=new ASTExtractionBlock(extractionBlock.getExtractedMethodName(),getReturnVariableDeclarationFragment(),getReturnVariableDeclarationStatement(),getStatementsForExtraction(),allVariableDeclarationStatements,allVariableDeclarationExpressions,extractionBlock.getAssignmentOperators());
  if (extractionBlock.getParentStatementForCopy() != null)   astExtractionBlock.setParentStatementForCopy(extractionBlock.getParentStatementForCopy().getStatement());
  for (  LocalVariableDeclarationObject lvdo : extractionBlock.getAdditionalRequiredVariableDeclarations()) {
    VariableDeclarationStatement variableDeclarationStatement=extractionBlock.getAdditionalRequiredVariableDeclarationStatement(lvdo);
    astExtractionBlock.addRequiredVariableDeclarationStatement(getVariableDeclarationFragment(lvdo,variableDeclarationStatement),variableDeclarationStatement);
  }
  return astExtractionBlock;
}