nus-yam/ex-repair huggingface dataset:
Program: 12211
Project: 12211
Buggy source:
private void replaceTargetClassVariableNameWithThisExpressionInCastExpressions(MethodDeclaration newMethodDeclaration){
  ExpressionExtractor extractor=new ExpressionExtractor();
  List<Expression> castExpressions=extractor.getCastExpressions(newMethodDeclaration.getBody());
  for (  Expression expression : castExpressions) {
    CastExpression castExpression=(CastExpression)expression;
    if (castExpression.getExpression() instanceof SimpleName) {
      SimpleName simpleName=(SimpleName)castExpression.getExpression();
      if (simpleName.getIdentifier().equals(targetClassVariableName)) {
        AST ast=newMethodDeclaration.getAST();
        targetRewriter.set(castExpression,CastExpression.EXPRESSION_PROPERTY,ast.newThisExpression(),null);
      }
    }
  }
}

Fixed version (ground truth):
private void replaceTargetClassVariableNameWithThisExpressionInCastExpressions(MethodDeclaration newMethodDeclaration){
  ExpressionExtractor extractor=new ExpressionExtractor();
  List<Expression> castExpressions=extractor.getCastExpressions(newMethodDeclaration.getBody());
  for (  Expression expression : castExpressions) {
    CastExpression castExpression=(CastExpression)expression;
    if (castExpression.getExpression() instanceof SimpleName) {
      SimpleName simpleName=(SimpleName)castExpression.getExpression();
      if (simpleName.getIdentifier().equals(targetClassVariableName)) {
        AST ast=newMethodDeclaration.getAST();
        targetRewriter.set(castExpression,CastExpression.EXPRESSION_PROPERTY,ast.newThisExpression(),null);
      }
    }
 else     if (castExpression.getExpression() instanceof FieldAccess) {
      FieldAccess fieldAccess=(FieldAccess)castExpression.getExpression();
      SimpleName simpleName=fieldAccess.getName();
      if (simpleName.getIdentifier().equals(targetClassVariableName)) {
        AST ast=newMethodDeclaration.getAST();
        targetRewriter.set(castExpression,CastExpression.EXPRESSION_PROPERTY,ast.newThisExpression(),null);
      }
    }
  }
}
Program: 12212
Project: 12212
Buggy source:
private void replaceTargetClassVariableNameWithThisExpressionInInstanceofExpressions(MethodDeclaration newMethodDeclaration){
  ExpressionExtractor extractor=new ExpressionExtractor();
  List<Expression> instanceofExpressions=extractor.getInstanceofExpressions(newMethodDeclaration.getBody());
  for (  Expression expression : instanceofExpressions) {
    InstanceofExpression instanceofExpression=(InstanceofExpression)expression;
    if (instanceofExpression.getLeftOperand() instanceof SimpleName) {
      SimpleName simpleName=(SimpleName)instanceofExpression.getLeftOperand();
      if (simpleName.getIdentifier().equals(targetClassVariableName)) {
        AST ast=newMethodDeclaration.getAST();
        targetRewriter.set(instanceofExpression,InstanceofExpression.LEFT_OPERAND_PROPERTY,ast.newThisExpression(),null);
      }
    }
  }
}

Fixed version (ground truth):
private void replaceTargetClassVariableNameWithThisExpressionInInstanceofExpressions(MethodDeclaration newMethodDeclaration){
  ExpressionExtractor extractor=new ExpressionExtractor();
  List<Expression> instanceofExpressions=extractor.getInstanceofExpressions(newMethodDeclaration.getBody());
  for (  Expression expression : instanceofExpressions) {
    InstanceofExpression instanceofExpression=(InstanceofExpression)expression;
    if (instanceofExpression.getLeftOperand() instanceof SimpleName) {
      SimpleName simpleName=(SimpleName)instanceofExpression.getLeftOperand();
      if (simpleName.getIdentifier().equals(targetClassVariableName)) {
        AST ast=newMethodDeclaration.getAST();
        targetRewriter.set(instanceofExpression,InstanceofExpression.LEFT_OPERAND_PROPERTY,ast.newThisExpression(),null);
      }
    }
 else     if (instanceofExpression.getLeftOperand() instanceof FieldAccess) {
      FieldAccess fieldAccess=(FieldAccess)instanceofExpression.getLeftOperand();
      SimpleName simpleName=fieldAccess.getName();
      if (simpleName.getIdentifier().equals(targetClassVariableName)) {
        AST ast=newMethodDeclaration.getAST();
        targetRewriter.set(instanceofExpression,InstanceofExpression.LEFT_OPERAND_PROPERTY,ast.newThisExpression(),null);
      }
    }
  }
}
Program: 12214
Project: 12214
Buggy source:
public boolean leaveDelegate(){
  List<ClassObject> excludedClasses=new ArrayList<ClassObject>();
  excludedClasses.add(getSourceClass().getClassObject());
  excludedClasses.add(getTargetClass().getClassObject());
  return system.getSystemObject().containsMethodInvocation(getSourceMethod().getMethodObject().generateMethodInvocation(),excludedClasses);
}

Fixed version (ground truth):
public boolean leaveDelegate(){
  return system.getSystemObject().containsMethodInvocation(getSourceMethod().getMethodObject().generateMethodInvocation(),getSourceClass().getClassObject());
}
Program: 12215
Project: 12215
Buggy source:
public void applySourceFirst(){
  if (!sourceCompilationUnit.equals(targetCompilationUnit))   addRequiredTargetImportDeclarations();
  createMovedMethod();
  moveAdditionalMethods();
  modifyMovedMethodInvocationInTargetClass();
  if (leaveDelegate) {
    addDelegationInSourceMethod();
  }
 else {
    removeSourceMethod();
  }
  modifyMovedMethodInvocationInSourceClass();
  ITextFileBufferManager bufferManager=FileBuffers.getTextFileBufferManager();
  ITextFileBuffer sourceTextFileBuffer=bufferManager.getTextFileBuffer(sourceFile.getFullPath(),LocationKind.IFILE);
  IDocument sourceDocument=sourceTextFileBuffer.getDocument();
  TextEdit sourceEdit=sourceRewriter.rewriteAST(sourceDocument,null);
  try {
    UndoEdit undoEdit=sourceEdit.apply(sourceDocument,UndoEdit.CREATE_UNDO);
    undoRefactoring.put(sourceFile,sourceDocument,undoEdit);
  }
 catch (  MalformedTreeException e) {
    e.printStackTrace();
  }
catch (  BadLocationException e) {
    e.printStackTrace();
  }
  ITextFileBuffer targetTextFileBuffer=bufferManager.getTextFileBuffer(targetFile.getFullPath(),LocationKind.IFILE);
  IDocument targetDocument=targetTextFileBuffer.getDocument();
  TextEdit targetEdit=targetRewriter.rewriteAST(targetDocument,null);
  try {
    UndoEdit undoEdit=targetEdit.apply(targetDocument,UndoEdit.CREATE_UNDO);
    undoRefactoring.put(targetFile,targetDocument,undoEdit);
  }
 catch (  MalformedTreeException e) {
    e.printStackTrace();
  }
catch (  BadLocationException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void applySourceFirst(){
  if (!sourceCompilationUnit.equals(targetCompilationUnit))   addRequiredTargetImportDeclarations();
  createMovedMethod();
  moveAdditionalMethods();
  if (leaveDelegate) {
    addDelegationInSourceMethod();
  }
 else {
    removeSourceMethod();
  }
  modifyMovedMethodInvocationInSourceClass();
  ITextFileBufferManager bufferManager=FileBuffers.getTextFileBufferManager();
  ITextFileBuffer sourceTextFileBuffer=bufferManager.getTextFileBuffer(sourceFile.getFullPath(),LocationKind.IFILE);
  IDocument sourceDocument=sourceTextFileBuffer.getDocument();
  TextEdit sourceEdit=sourceRewriter.rewriteAST(sourceDocument,null);
  try {
    UndoEdit undoEdit=sourceEdit.apply(sourceDocument,UndoEdit.CREATE_UNDO);
    undoRefactoring.put(sourceFile,sourceDocument,undoEdit);
  }
 catch (  MalformedTreeException e) {
    e.printStackTrace();
  }
catch (  BadLocationException e) {
    e.printStackTrace();
  }
  ITextFileBuffer targetTextFileBuffer=bufferManager.getTextFileBuffer(targetFile.getFullPath(),LocationKind.IFILE);
  IDocument targetDocument=targetTextFileBuffer.getDocument();
  TextEdit targetEdit=targetRewriter.rewriteAST(targetDocument,null);
  try {
    UndoEdit undoEdit=targetEdit.apply(targetDocument,UndoEdit.CREATE_UNDO);
    undoRefactoring.put(targetFile,targetDocument,undoEdit);
  }
 catch (  MalformedTreeException e) {
    e.printStackTrace();
  }
catch (  BadLocationException e) {
    e.printStackTrace();
  }
}
Program: 12216
Project: 12216
Buggy source:
public void applyTargetFirst(){
  if (!sourceCompilationUnit.equals(targetCompilationUnit))   addRequiredTargetImportDeclarations();
  createMovedMethod();
  moveAdditionalMethods();
  modifyMovedMethodInvocationInTargetClass();
  if (leaveDelegate) {
    addDelegationInSourceMethod();
  }
 else {
    removeSourceMethod();
  }
  modifyMovedMethodInvocationInSourceClass();
  ITextFileBufferManager bufferManager=FileBuffers.getTextFileBufferManager();
  ITextFileBuffer targetTextFileBuffer=bufferManager.getTextFileBuffer(targetFile.getFullPath(),LocationKind.IFILE);
  IDocument targetDocument=targetTextFileBuffer.getDocument();
  TextEdit targetEdit=targetRewriter.rewriteAST(targetDocument,null);
  try {
    UndoEdit undoEdit=targetEdit.apply(targetDocument,UndoEdit.CREATE_UNDO);
    undoRefactoring.put(targetFile,targetDocument,undoEdit);
  }
 catch (  MalformedTreeException e) {
    e.printStackTrace();
  }
catch (  BadLocationException e) {
    e.printStackTrace();
  }
  ITextFileBuffer sourceTextFileBuffer=bufferManager.getTextFileBuffer(sourceFile.getFullPath(),LocationKind.IFILE);
  IDocument sourceDocument=sourceTextFileBuffer.getDocument();
  TextEdit sourceEdit=sourceRewriter.rewriteAST(sourceDocument,null);
  try {
    UndoEdit undoEdit=sourceEdit.apply(sourceDocument,UndoEdit.CREATE_UNDO);
    undoRefactoring.put(sourceFile,sourceDocument,undoEdit);
  }
 catch (  MalformedTreeException e) {
    e.printStackTrace();
  }
catch (  BadLocationException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void applyTargetFirst(){
  if (!sourceCompilationUnit.equals(targetCompilationUnit))   addRequiredTargetImportDeclarations();
  createMovedMethod();
  moveAdditionalMethods();
  if (leaveDelegate) {
    addDelegationInSourceMethod();
  }
 else {
    removeSourceMethod();
  }
  modifyMovedMethodInvocationInSourceClass();
  ITextFileBufferManager bufferManager=FileBuffers.getTextFileBufferManager();
  ITextFileBuffer targetTextFileBuffer=bufferManager.getTextFileBuffer(targetFile.getFullPath(),LocationKind.IFILE);
  IDocument targetDocument=targetTextFileBuffer.getDocument();
  TextEdit targetEdit=targetRewriter.rewriteAST(targetDocument,null);
  try {
    UndoEdit undoEdit=targetEdit.apply(targetDocument,UndoEdit.CREATE_UNDO);
    undoRefactoring.put(targetFile,targetDocument,undoEdit);
  }
 catch (  MalformedTreeException e) {
    e.printStackTrace();
  }
catch (  BadLocationException e) {
    e.printStackTrace();
  }
  ITextFileBuffer sourceTextFileBuffer=bufferManager.getTextFileBuffer(sourceFile.getFullPath(),LocationKind.IFILE);
  IDocument sourceDocument=sourceTextFileBuffer.getDocument();
  TextEdit sourceEdit=sourceRewriter.rewriteAST(sourceDocument,null);
  try {
    UndoEdit undoEdit=sourceEdit.apply(sourceDocument,UndoEdit.CREATE_UNDO);
    undoRefactoring.put(sourceFile,sourceDocument,undoEdit);
  }
 catch (  MalformedTreeException e) {
    e.printStackTrace();
  }
catch (  BadLocationException e) {
    e.printStackTrace();
  }
}
Program: 12227
Project: 12227
Buggy source:
public boolean containsMethodInvocation(MethodInvocationObject methodInvocation,ClassObject excludedClass){
  for (  ClassObject classObject : classList) {
    TypeDeclaration outerTypeDeclaration=classObject.getOuterClass();
    boolean isInnerOfExcludedClasses=false;
    if (outerTypeDeclaration != null) {
      if (outerTypeDeclaration.equals(excludedClass.getTypeDeclaration()))       isInnerOfExcludedClasses=true;
    }
    if (!isInnerOfExcludedClasses && !excludedClass.equals(classObject) && classObject.containsMethodInvocation(methodInvocation))     return true;
  }
  return false;
}

Fixed version (ground truth):
public boolean containsMethodInvocation(MethodInvocationObject methodInvocation,ClassObject excludedClass){
  for (  ClassObject classObject : classList) {
    if (!excludedClass.equals(classObject) && classObject.containsMethodInvocation(methodInvocation))     return true;
  }
  return false;
}
Program: 12231
Project: 12231
Buggy source:
public void applySourceFirst(){
  if (leaveDelegate) {
    addDelegationInSourceMethod();
  }
 else {
    removeSourceMethod();
  }
  modifyMovedMethodInvocationInSourceClass();
  ITextFileBufferManager bufferManager=FileBuffers.getTextFileBufferManager();
  ITextFileBuffer sourceTextFileBuffer=bufferManager.getTextFileBuffer(sourceFile.getFullPath(),LocationKind.IFILE);
  IDocument sourceDocument=sourceTextFileBuffer.getDocument();
  TextEdit sourceEdit=sourceRewriter.rewriteAST(sourceDocument,null);
  try {
    UndoEdit undoEdit=sourceEdit.apply(sourceDocument,UndoEdit.CREATE_UNDO);
    undoRefactoring.put(sourceFile,sourceDocument,undoEdit);
  }
 catch (  MalformedTreeException e) {
    e.printStackTrace();
  }
catch (  BadLocationException e) {
    e.printStackTrace();
  }
  addRequiredTargetImportDeclarations();
  createMovedMethod();
  moveAdditionalMethods();
  modifyMovedMethodInvocationInTargetClass();
  ITextFileBuffer targetTextFileBuffer=bufferManager.getTextFileBuffer(targetFile.getFullPath(),LocationKind.IFILE);
  IDocument targetDocument=targetTextFileBuffer.getDocument();
  TextEdit targetEdit=targetRewriter.rewriteAST(targetDocument,null);
  try {
    UndoEdit undoEdit=targetEdit.apply(targetDocument,UndoEdit.CREATE_UNDO);
    undoRefactoring.put(targetFile,targetDocument,undoEdit);
  }
 catch (  MalformedTreeException e) {
    e.printStackTrace();
  }
catch (  BadLocationException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void applySourceFirst(){
  if (!sourceCompilationUnit.equals(targetCompilationUnit))   addRequiredTargetImportDeclarations();
  createMovedMethod();
  moveAdditionalMethods();
  modifyMovedMethodInvocationInTargetClass();
  if (leaveDelegate) {
    addDelegationInSourceMethod();
  }
 else {
    removeSourceMethod();
  }
  modifyMovedMethodInvocationInSourceClass();
  ITextFileBufferManager bufferManager=FileBuffers.getTextFileBufferManager();
  ITextFileBuffer sourceTextFileBuffer=bufferManager.getTextFileBuffer(sourceFile.getFullPath(),LocationKind.IFILE);
  IDocument sourceDocument=sourceTextFileBuffer.getDocument();
  TextEdit sourceEdit=sourceRewriter.rewriteAST(sourceDocument,null);
  try {
    UndoEdit undoEdit=sourceEdit.apply(sourceDocument,UndoEdit.CREATE_UNDO);
    undoRefactoring.put(sourceFile,sourceDocument,undoEdit);
  }
 catch (  MalformedTreeException e) {
    e.printStackTrace();
  }
catch (  BadLocationException e) {
    e.printStackTrace();
  }
  ITextFileBuffer targetTextFileBuffer=bufferManager.getTextFileBuffer(targetFile.getFullPath(),LocationKind.IFILE);
  IDocument targetDocument=targetTextFileBuffer.getDocument();
  TextEdit targetEdit=targetRewriter.rewriteAST(targetDocument,null);
  try {
    UndoEdit undoEdit=targetEdit.apply(targetDocument,UndoEdit.CREATE_UNDO);
    undoRefactoring.put(targetFile,targetDocument,undoEdit);
  }
 catch (  MalformedTreeException e) {
    e.printStackTrace();
  }
catch (  BadLocationException e) {
    e.printStackTrace();
  }
}
Program: 12232
Project: 12232
Buggy source:
public void applyTargetFirst(){
  addRequiredTargetImportDeclarations();
  createMovedMethod();
  moveAdditionalMethods();
  modifyMovedMethodInvocationInTargetClass();
  ITextFileBufferManager bufferManager=FileBuffers.getTextFileBufferManager();
  ITextFileBuffer targetTextFileBuffer=bufferManager.getTextFileBuffer(targetFile.getFullPath(),LocationKind.IFILE);
  IDocument targetDocument=targetTextFileBuffer.getDocument();
  TextEdit targetEdit=targetRewriter.rewriteAST(targetDocument,null);
  try {
    UndoEdit undoEdit=targetEdit.apply(targetDocument,UndoEdit.CREATE_UNDO);
    undoRefactoring.put(targetFile,targetDocument,undoEdit);
  }
 catch (  MalformedTreeException e) {
    e.printStackTrace();
  }
catch (  BadLocationException e) {
    e.printStackTrace();
  }
  if (leaveDelegate) {
    addDelegationInSourceMethod();
  }
 else {
    removeSourceMethod();
  }
  modifyMovedMethodInvocationInSourceClass();
  ITextFileBuffer sourceTextFileBuffer=bufferManager.getTextFileBuffer(sourceFile.getFullPath(),LocationKind.IFILE);
  IDocument sourceDocument=sourceTextFileBuffer.getDocument();
  TextEdit sourceEdit=sourceRewriter.rewriteAST(sourceDocument,null);
  try {
    UndoEdit undoEdit=sourceEdit.apply(sourceDocument,UndoEdit.CREATE_UNDO);
    undoRefactoring.put(sourceFile,sourceDocument,undoEdit);
  }
 catch (  MalformedTreeException e) {
    e.printStackTrace();
  }
catch (  BadLocationException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void applyTargetFirst(){
  if (!sourceCompilationUnit.equals(targetCompilationUnit))   addRequiredTargetImportDeclarations();
  createMovedMethod();
  moveAdditionalMethods();
  modifyMovedMethodInvocationInTargetClass();
  if (leaveDelegate) {
    addDelegationInSourceMethod();
  }
 else {
    removeSourceMethod();
  }
  modifyMovedMethodInvocationInSourceClass();
  ITextFileBufferManager bufferManager=FileBuffers.getTextFileBufferManager();
  ITextFileBuffer targetTextFileBuffer=bufferManager.getTextFileBuffer(targetFile.getFullPath(),LocationKind.IFILE);
  IDocument targetDocument=targetTextFileBuffer.getDocument();
  TextEdit targetEdit=targetRewriter.rewriteAST(targetDocument,null);
  try {
    UndoEdit undoEdit=targetEdit.apply(targetDocument,UndoEdit.CREATE_UNDO);
    undoRefactoring.put(targetFile,targetDocument,undoEdit);
  }
 catch (  MalformedTreeException e) {
    e.printStackTrace();
  }
catch (  BadLocationException e) {
    e.printStackTrace();
  }
  ITextFileBuffer sourceTextFileBuffer=bufferManager.getTextFileBuffer(sourceFile.getFullPath(),LocationKind.IFILE);
  IDocument sourceDocument=sourceTextFileBuffer.getDocument();
  TextEdit sourceEdit=sourceRewriter.rewriteAST(sourceDocument,null);
  try {
    UndoEdit undoEdit=sourceEdit.apply(sourceDocument,UndoEdit.CREATE_UNDO);
    undoRefactoring.put(sourceFile,sourceDocument,undoEdit);
  }
 catch (  MalformedTreeException e) {
    e.printStackTrace();
  }
catch (  BadLocationException e) {
    e.printStackTrace();
  }
}
Program: 12238
Project: 12238
Buggy source:
public ASTExtractionBlock(String extractedMethodName,VariableDeclarationFragment returnVariableDeclarationFragment,VariableDeclarationStatement returnVariableDeclarationStatement,List<Statement> statementsForExtraction,List<VariableDeclarationStatement> allVariableDeclarationStatements,List<String> assignmentOperators){
  this.extractedMethodName=extractedMethodName;
  this.returnVariableDeclarationFragment=returnVariableDeclarationFragment;
  this.returnVariableDeclarationStatement=returnVariableDeclarationStatement;
  this.statementsForExtraction=statementsForExtraction;
  this.allVariableDeclarationStatements=allVariableDeclarationStatements;
  this.assignmentOperators=assignmentOperators;
  this.parentStatementForCopy=null;
  this.additionalRequiredVariableDeclarationStatementMap=new LinkedHashMap<VariableDeclarationFragment,VariableDeclarationStatement>();
}

Fixed version (ground truth):
public ASTExtractionBlock(String extractedMethodName,VariableDeclarationFragment returnVariableDeclarationFragment,VariableDeclarationStatement returnVariableDeclarationStatement,List<Statement> statementsForExtraction,List<VariableDeclarationStatement> allVariableDeclarationStatements,List<VariableDeclarationExpression> allVariableDeclarationExpressions,List<String> assignmentOperators){
  this.extractedMethodName=extractedMethodName;
  this.returnVariableDeclarationFragment=returnVariableDeclarationFragment;
  this.returnVariableDeclarationStatement=returnVariableDeclarationStatement;
  this.statementsForExtraction=statementsForExtraction;
  this.allVariableDeclarationStatements=allVariableDeclarationStatements;
  this.allVariableDeclarationExpressions=allVariableDeclarationExpressions;
  this.assignmentOperators=assignmentOperators;
  this.parentStatementForCopy=null;
  this.additionalRequiredVariableDeclarationStatementMap=new LinkedHashMap<VariableDeclarationFragment,VariableDeclarationStatement>();
}
Program: 12244
Project: 12244
Buggy source:
private Expression constructExpression(AST ast,ASTRewrite rewriter,DefaultMutableTreeNode node){
  Object object=node.getUserObject();
  if (object instanceof InfixExpression.Operator) {
    InfixExpression.Operator operator=(InfixExpression.Operator)object;
    InfixExpression infixExpression=ast.newInfixExpression();
    rewriter.set(infixExpression,InfixExpression.OPERATOR_PROPERTY,operator,null);
    DefaultMutableTreeNode leftChild=(DefaultMutableTreeNode)node.getChildAt(0);
    DefaultMutableTreeNode rightChild=(DefaultMutableTreeNode)node.getChildAt(1);
    rewriter.set(infixExpression,InfixExpression.LEFT_OPERAND_PROPERTY,constructExpression(ast,rewriter,leftChild),null);
    rewriter.set(infixExpression,InfixExpression.RIGHT_OPERAND_PROPERTY,constructExpression(ast,rewriter,rightChild),null);
    return infixExpression;
  }
 else   if (object instanceof Expression) {
    Expression expression=(Expression)object;
    return expression;
  }
  return null;
}

Fixed version (ground truth):
private Expression constructExpression(AST ast,DefaultMutableTreeNode node){
  Object object=node.getUserObject();
  if (object instanceof InfixExpression.Operator) {
    InfixExpression.Operator operator=(InfixExpression.Operator)object;
    InfixExpression infixExpression=ast.newInfixExpression();
    infixExpression.setOperator(operator);
    DefaultMutableTreeNode leftChild=(DefaultMutableTreeNode)node.getChildAt(0);
    DefaultMutableTreeNode rightChild=(DefaultMutableTreeNode)node.getChildAt(1);
    infixExpression.setLeftOperand(constructExpression(ast,leftChild));
    infixExpression.setRightOperand(constructExpression(ast,rightChild));
    return infixExpression;
  }
 else   if (object instanceof Expression) {
    Expression expression=(Expression)object;
    return (Expression)ASTNode.copySubtree(ast,expression);
  }
  return null;
}
Program: 12246
Project: 12246
Buggy source:
private Expression constructExpression(AST ast,ASTRewrite rewriter,DefaultMutableTreeNode node){
  Object object=node.getUserObject();
  if (object instanceof InfixExpression.Operator) {
    InfixExpression.Operator operator=(InfixExpression.Operator)object;
    InfixExpression infixExpression=ast.newInfixExpression();
    rewriter.set(infixExpression,InfixExpression.OPERATOR_PROPERTY,operator,null);
    DefaultMutableTreeNode leftChild=(DefaultMutableTreeNode)node.getChildAt(0);
    DefaultMutableTreeNode rightChild=(DefaultMutableTreeNode)node.getChildAt(1);
    rewriter.set(infixExpression,InfixExpression.LEFT_OPERAND_PROPERTY,constructExpression(ast,rewriter,leftChild),null);
    rewriter.set(infixExpression,InfixExpression.RIGHT_OPERAND_PROPERTY,constructExpression(ast,rewriter,rightChild),null);
    return infixExpression;
  }
 else   if (object instanceof Expression) {
    Expression expression=(Expression)object;
    return expression;
  }
  return null;
}

Fixed version (ground truth):
private Expression constructExpression(AST ast,DefaultMutableTreeNode node){
  Object object=node.getUserObject();
  if (object instanceof InfixExpression.Operator) {
    InfixExpression.Operator operator=(InfixExpression.Operator)object;
    InfixExpression infixExpression=ast.newInfixExpression();
    infixExpression.setOperator(operator);
    DefaultMutableTreeNode leftChild=(DefaultMutableTreeNode)node.getChildAt(0);
    DefaultMutableTreeNode rightChild=(DefaultMutableTreeNode)node.getChildAt(1);
    infixExpression.setLeftOperand(constructExpression(ast,leftChild));
    infixExpression.setRightOperand(constructExpression(ast,rightChild));
    return infixExpression;
  }
 else   if (object instanceof Expression) {
    Expression expression=(Expression)object;
    return (Expression)ASTNode.copySubtree(ast,expression);
  }
  return null;
}
Program: 12249
Project: 12249
Buggy source:
public static Set<String> intersection(Set<String> set1,Set<String> set2){
  Set<String> set=new HashSet<String>();
  for (  String s1 : set1) {
    for (    String s2 : set2) {
      if (s1.equals(s2))       set.add(s1);
    }
  }
  return set;
}

Fixed version (ground truth):
public static Set<String> intersection(Set<String> set1,Set<String> set2){
  Set<String> set=new HashSet<String>();
  set.addAll(set1);
  set.retainAll(set2);
  return set;
}
Program: 12253
Project: 12253
Buggy source:
public boolean allTypeChecksContainStaticField(){
  return typeCheckMap.keySet().size() == staticFieldMap.keySet().size();
}

Fixed version (ground truth):
public boolean allTypeChecksContainStaticField(){
  return (typeCheckMap.keySet().size() > 1) && (typeCheckMap.keySet().size() == staticFieldMap.keySet().size());
}
Program: 12260
Project: 12260
Buggy source:
public String getAbstractClassName(){
  if (typeField != null) {
    String typeFieldName=typeField.getName().getIdentifier();
    return typeFieldName.substring(0,1).toUpperCase() + typeFieldName.substring(1,typeFieldName.length());
  }
 else   if (existingInheritanceTree != null) {
    DefaultMutableTreeNode root=existingInheritanceTree.getRootNode();
    return (String)root.getUserObject();
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
public String getAbstractClassName(){
  if (typeField != null) {
    String typeFieldName=typeField.getName().getIdentifier().replaceAll("String_Node_Str","String_Node_Str");
    return typeFieldName.substring(0,1).toUpperCase() + typeFieldName.substring(1,typeFieldName.length());
  }
 else   if (existingInheritanceTree != null) {
    DefaultMutableTreeNode root=existingInheritanceTree.getRootNode();
    return (String)root.getUserObject();
  }
 else {
    return null;
  }
}
Program: 12262
Project: 12262
Buggy source:
public void setParentStatementForCopy(AbstractStatement parentStatementForCopy){
  this.parentStatementForCopy=parentStatementForCopy;
}

Fixed version (ground truth):
public void setParentStatementForCopy(CompositeStatementObject parentStatementForCopy){
  this.parentStatementForCopy=parentStatementForCopy;
}
Program: 12272
Project: 12272
Buggy source:
private SimpleName addSourceClassParameterToMovedMethod(MethodDeclaration newMethodDeclaration){
  AST ast=newMethodDeclaration.getAST();
  SingleVariableDeclaration parameter=ast.newSingleVariableDeclaration();
  SimpleName typeName=ast.newSimpleName(sourceTypeDeclaration.getName().getIdentifier());
  Type parameterType=ast.newSimpleType(typeName);
  targetRewriter.set(parameter,SingleVariableDeclaration.TYPE_PROPERTY,parameterType,null);
  String sourceTypeName=sourceTypeDeclaration.getName().getIdentifier();
  SimpleName parameterName=ast.newSimpleName(sourceTypeName.replace(sourceTypeName.charAt(0),Character.toLowerCase(sourceTypeName.charAt(0))));
  targetRewriter.set(parameter,SingleVariableDeclaration.NAME_PROPERTY,parameterName,null);
  ListRewrite parametersRewrite=targetRewriter.getListRewrite(newMethodDeclaration,MethodDeclaration.PARAMETERS_PROPERTY);
  parametersRewrite.insertLast(parameter,null);
  this.additionalArgumentsAddedToMovedMethod.add("String_Node_Str");
  return parameterName;
}

Fixed version (ground truth):
private SimpleName addSourceClassParameterToMovedMethod(MethodDeclaration newMethodDeclaration){
  AST ast=newMethodDeclaration.getAST();
  SingleVariableDeclaration parameter=ast.newSingleVariableDeclaration();
  SimpleName typeName=ast.newSimpleName(sourceTypeDeclaration.getName().getIdentifier());
  Type parameterType=ast.newSimpleType(typeName);
  targetRewriter.set(parameter,SingleVariableDeclaration.TYPE_PROPERTY,parameterType,null);
  String sourceTypeName=sourceTypeDeclaration.getName().getIdentifier();
  SimpleName parameterName=ast.newSimpleName(sourceTypeName.replaceFirst(Character.toString(sourceTypeName.charAt(0)),Character.toString(Character.toLowerCase(sourceTypeName.charAt(0)))));
  targetRewriter.set(parameter,SingleVariableDeclaration.NAME_PROPERTY,parameterName,null);
  ListRewrite parametersRewrite=targetRewriter.getListRewrite(newMethodDeclaration,MethodDeclaration.PARAMETERS_PROPERTY);
  parametersRewrite.insertLast(parameter,null);
  this.additionalArgumentsAddedToMovedMethod.add("String_Node_Str");
  return parameterName;
}
Program: 12273
Project: 12273
Buggy source:
private void replaceThisExpressionWithSourceClassParameterInMethodInvocationArguments(MethodDeclaration newMethodDeclaration){
  ExpressionExtractor extractor=new ExpressionExtractor();
  List<Expression> methodInvocations=extractor.getMethodInvocations(newMethodDeclaration.getBody());
  for (  Expression invocation : methodInvocations) {
    if (invocation instanceof MethodInvocation) {
      MethodInvocation methodInvocation=(MethodInvocation)invocation;
      List<Expression> arguments=methodInvocation.arguments();
      for (      Expression argument : arguments) {
        if (argument instanceof ThisExpression) {
          SimpleName parameterName=null;
          if (!additionalArgumentsAddedToMovedMethod.contains("String_Node_Str")) {
            parameterName=addSourceClassParameterToMovedMethod(newMethodDeclaration);
          }
 else {
            AST ast=newMethodDeclaration.getAST();
            String sourceTypeName=sourceTypeDeclaration.getName().getIdentifier();
            parameterName=ast.newSimpleName(sourceTypeName.replace(sourceTypeName.charAt(0),Character.toLowerCase(sourceTypeName.charAt(0))));
          }
          ListRewrite argumentRewrite=targetRewriter.getListRewrite(methodInvocation,MethodInvocation.ARGUMENTS_PROPERTY);
          argumentRewrite.replace(argument,parameterName,null);
        }
      }
    }
  }
}

Fixed version (ground truth):
private void replaceThisExpressionWithSourceClassParameterInMethodInvocationArguments(MethodDeclaration newMethodDeclaration){
  ExpressionExtractor extractor=new ExpressionExtractor();
  List<Expression> methodInvocations=extractor.getMethodInvocations(newMethodDeclaration.getBody());
  for (  Expression invocation : methodInvocations) {
    if (invocation instanceof MethodInvocation) {
      MethodInvocation methodInvocation=(MethodInvocation)invocation;
      List<Expression> arguments=methodInvocation.arguments();
      for (      Expression argument : arguments) {
        if (argument instanceof ThisExpression) {
          SimpleName parameterName=null;
          if (!additionalArgumentsAddedToMovedMethod.contains("String_Node_Str")) {
            parameterName=addSourceClassParameterToMovedMethod(newMethodDeclaration);
          }
 else {
            AST ast=newMethodDeclaration.getAST();
            String sourceTypeName=sourceTypeDeclaration.getName().getIdentifier();
            parameterName=ast.newSimpleName(sourceTypeName.replaceFirst(Character.toString(sourceTypeName.charAt(0)),Character.toString(Character.toLowerCase(sourceTypeName.charAt(0)))));
          }
          ListRewrite argumentRewrite=targetRewriter.getListRewrite(methodInvocation,MethodInvocation.ARGUMENTS_PROPERTY);
          argumentRewrite.replace(argument,parameterName,null);
        }
      }
    }
  }
}
Program: 12276
Project: 12276
Buggy source:
private void modifyTargetMethodInvocations(MethodDeclaration newMethodDeclaration,String targetClassVariableName){
  ExpressionExtractor extractor=new ExpressionExtractor();
  List<Expression> sourceMethodInvocations=extractor.getMethodInvocations(sourceMethod.getBody());
  List<Expression> newMethodInvocations=extractor.getMethodInvocations(newMethodDeclaration.getBody());
  int i=0;
  for (  Expression expression : sourceMethodInvocations) {
    if (expression instanceof MethodInvocation) {
      MethodInvocation methodInvocation=(MethodInvocation)expression;
      Expression methodInvocationExpression=methodInvocation.getExpression();
      if (methodInvocationExpression instanceof SimpleName) {
        SimpleName methodInvocationExpressionSimpleName=(SimpleName)methodInvocationExpression;
        if (methodInvocationExpressionSimpleName.resolveTypeBinding().getQualifiedName().equals(targetTypeDeclaration.resolveBinding().getQualifiedName()) && targetClassVariableName.equals(methodInvocationExpressionSimpleName.getIdentifier())) {
          MethodInvocation newMethodInvocation=(MethodInvocation)newMethodInvocations.get(i);
          targetRewriter.remove(newMethodInvocation.getExpression(),null);
        }
      }
    }
    i++;
  }
}

Fixed version (ground truth):
private void modifyTargetMethodInvocations(MethodDeclaration newMethodDeclaration){
  ExpressionExtractor extractor=new ExpressionExtractor();
  List<Expression> sourceMethodInvocations=extractor.getMethodInvocations(sourceMethod.getBody());
  List<Expression> newMethodInvocations=extractor.getMethodInvocations(newMethodDeclaration.getBody());
  int i=0;
  for (  Expression expression : sourceMethodInvocations) {
    if (expression instanceof MethodInvocation) {
      MethodInvocation methodInvocation=(MethodInvocation)expression;
      Expression methodInvocationExpression=methodInvocation.getExpression();
      if (methodInvocationExpression instanceof SimpleName) {
        SimpleName methodInvocationExpressionSimpleName=(SimpleName)methodInvocationExpression;
        if (methodInvocationExpressionSimpleName.resolveTypeBinding().getQualifiedName().equals(targetTypeDeclaration.resolveBinding().getQualifiedName()) && methodInvocationExpressionSimpleName.getIdentifier().equals(targetClassVariableName)) {
          MethodInvocation newMethodInvocation=(MethodInvocation)newMethodInvocations.get(i);
          targetRewriter.remove(newMethodInvocation.getExpression(),null);
        }
      }
 else       if (methodInvocationExpression instanceof FieldAccess) {
        FieldAccess methodInvocationExpressionFieldAccess=(FieldAccess)methodInvocationExpression;
        if (methodInvocationExpressionFieldAccess.getName().resolveTypeBinding().getQualifiedName().equals(targetTypeDeclaration.resolveBinding().getQualifiedName()) && methodInvocationExpressionFieldAccess.getName().getIdentifier().equals(targetClassVariableName)) {
          MethodInvocation newMethodInvocation=(MethodInvocation)newMethodInvocations.get(i);
          targetRewriter.remove(newMethodInvocation.getExpression(),null);
        }
      }
    }
    i++;
  }
}
Program: 12278
Project: 12278
Buggy source:
public void setDistinctExtractedMethodName(){
  String sourceMethodName=sourceMethod.getMethodName();
  extractionBlock.setExtractedMethodName(extractionBlock.getReturnVariableDeclaration().getName() + sourceMethodName.replaceFirst(Character.toString(sourceMethodName.charAt(0)),Character.toString(Character.toUpperCase(sourceMethodName.charAt(0)))));
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
public void setDistinctExtractedMethodName(){
  String sourceMethodName=sourceMethod.getMethodName();
  extractionBlock.setExtractedMethodName(extractionBlock.getReturnVariableDeclaration().getName() + sourceMethodName.replaceFirst(Character.toString(sourceMethodName.charAt(0)),Character.toString(Character.toUpperCase(sourceMethodName.charAt(0)))));
}
Program: 12279
Project: 12279
Buggy source:
public void apply(){
  addRequiredTargetImportDeclarations();
  createMovedMethod();
  moveAdditionalMethods();
  ITextFileBufferManager bufferManager=FileBuffers.getTextFileBufferManager();
  ITextFileBuffer targetTextFileBuffer=bufferManager.getTextFileBuffer(targetFile.getFullPath(),LocationKind.IFILE);
  IDocument targetDocument=targetTextFileBuffer.getDocument();
  TextEdit targetEdit=targetRewriter.rewriteAST(targetDocument,null);
  try {
    UndoEdit undoEdit=targetEdit.apply(targetDocument,UndoEdit.CREATE_UNDO);
    undoRefactoring.put(targetFile,targetDocument,undoEdit);
  }
 catch (  MalformedTreeException e) {
    e.printStackTrace();
  }
catch (  BadLocationException e) {
    e.printStackTrace();
  }
  if (leaveDelegate) {
    addDelegationInSourceMethod();
  }
 else {
    removeSourceMethod();
  }
  modifyMovedMethodInvocationInSourceClass();
  ITextFileBuffer sourceTextFileBuffer=bufferManager.getTextFileBuffer(sourceFile.getFullPath(),LocationKind.IFILE);
  IDocument sourceDocument=sourceTextFileBuffer.getDocument();
  TextEdit sourceEdit=sourceRewriter.rewriteAST(sourceDocument,null);
  try {
    UndoEdit undoEdit=sourceEdit.apply(sourceDocument,UndoEdit.CREATE_UNDO);
    undoRefactoring.put(sourceFile,sourceDocument,undoEdit);
  }
 catch (  MalformedTreeException e) {
    e.printStackTrace();
  }
catch (  BadLocationException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void apply(){
  addRequiredTargetImportDeclarations();
  createMovedMethod();
  moveAdditionalMethods();
  modifyMovedMethodInvocationInTargetClass();
  ITextFileBufferManager bufferManager=FileBuffers.getTextFileBufferManager();
  ITextFileBuffer targetTextFileBuffer=bufferManager.getTextFileBuffer(targetFile.getFullPath(),LocationKind.IFILE);
  IDocument targetDocument=targetTextFileBuffer.getDocument();
  TextEdit targetEdit=targetRewriter.rewriteAST(targetDocument,null);
  try {
    UndoEdit undoEdit=targetEdit.apply(targetDocument,UndoEdit.CREATE_UNDO);
    undoRefactoring.put(targetFile,targetDocument,undoEdit);
  }
 catch (  MalformedTreeException e) {
    e.printStackTrace();
  }
catch (  BadLocationException e) {
    e.printStackTrace();
  }
  if (leaveDelegate) {
    addDelegationInSourceMethod();
  }
 else {
    removeSourceMethod();
  }
  modifyMovedMethodInvocationInSourceClass();
  ITextFileBuffer sourceTextFileBuffer=bufferManager.getTextFileBuffer(sourceFile.getFullPath(),LocationKind.IFILE);
  IDocument sourceDocument=sourceTextFileBuffer.getDocument();
  TextEdit sourceEdit=sourceRewriter.rewriteAST(sourceDocument,null);
  try {
    UndoEdit undoEdit=sourceEdit.apply(sourceDocument,UndoEdit.CREATE_UNDO);
    undoRefactoring.put(sourceFile,sourceDocument,undoEdit);
  }
 catch (  MalformedTreeException e) {
    e.printStackTrace();
  }
catch (  BadLocationException e) {
    e.printStackTrace();
  }
}
Program: 12283
Project: 12283
Buggy source:
public ExtractMethodRefactoring(IFile sourceFile,TypeDeclaration sourceTypeDeclaration,MethodDeclaration sourceMethodDeclaration,VariableDeclarationStatement variableDeclarationStatement,VariableDeclarationFragment variableDeclarationFragment,List<Statement> extractStatementList,List<VariableDeclarationStatement> variableDeclarationStatementList){
  this.sourceFile=sourceFile;
  this.sourceTypeDeclaration=sourceTypeDeclaration;
  this.sourceMethodDeclaration=sourceMethodDeclaration;
  this.variableDeclarationStatement=variableDeclarationStatement;
  this.variableDeclarationFragment=variableDeclarationFragment;
  this.extractStatementList=extractStatementList;
  this.variableDeclarationStatementList=variableDeclarationStatementList;
}

Fixed version (ground truth):
public ExtractMethodRefactoring(IFile sourceFile,TypeDeclaration sourceTypeDeclaration,MethodDeclaration sourceMethodDeclaration,VariableDeclarationStatement variableDeclarationStatement,VariableDeclarationFragment variableDeclarationFragment,List<Statement> extractStatementList,List<VariableDeclarationStatement> variableDeclarationStatementList){
  this.sourceFile=sourceFile;
  this.sourceTypeDeclaration=sourceTypeDeclaration;
  this.sourceMethodDeclaration=sourceMethodDeclaration;
  this.variableDeclarationStatement=variableDeclarationStatement;
  this.variableDeclarationFragment=variableDeclarationFragment;
  this.extractStatementList=extractStatementList;
  this.variableDeclarationStatementList=variableDeclarationStatementList;
  this.sourceRewriter=ASTRewrite.create(sourceTypeDeclaration.getAST());
}
Program: 12286
Project: 12286
Buggy source:
public static void main(String[] args) throws IOException, SAXException, ParserConfigurationException {
  System.out.println("String_Node_Str" + countWordsInTerms(args[0]));
  System.out.println("String_Node_Str" + countWords(args[0]));
  parse(args[0],args[1]);
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException, SAXException, ParserConfigurationException {
  parse(args[0],args[1]);
}
Program: 12287
Project: 12287
Buggy source:
public static void parse(String xmlFile,String outFolder) throws ParserConfigurationException, IOException, SAXException {
  DocumentBuilder docBuilder=DocumentBuilderFactory.newInstance().newDocumentBuilder();
  FileInputStream xmlFileStream=new FileInputStream(new File(xmlFile));
  try {
    Document document=docBuilder.parse(xmlFileStream);
    NodeList nodeList=document.getDocumentElement().getElementsByTagName("String_Node_Str");
    for (int i=0; i < nodeList.getLength(); i++) {
      Element doc=(Element)nodeList.item(i);
      NodeList docId=doc.getElementsByTagName("String_Node_Str");
      String id=docId.item(0).getFirstChild().getNodeValue();
      id=i + "String_Node_Str" + id.replaceAll("String_Node_Str","String_Node_Str");
      PrintWriter p=new PrintWriter(outFolder + File.separator + id+ "String_Node_Str");
      NodeList sentences=doc.getElementsByTagName("String_Node_Str");
      for (int j=0; j < sentences.getLength(); j++) {
        Node sent=sentences.item(j);
        p.println(sent.getTextContent());
      }
      p.close();
    }
  }
  finally {
    xmlFileStream.close();
  }
}

Fixed version (ground truth):
public static void parse(String xmlFile,String outFolder) throws ParserConfigurationException, IOException, SAXException {
  DocumentBuilder docBuilder=DocumentBuilderFactory.newInstance().newDocumentBuilder();
  FileInputStream xmlFileStream=new FileInputStream(new File(xmlFile));
  try {
    Document document=docBuilder.parse(xmlFileStream);
    NodeList nodeList=document.getDocumentElement().getElementsByTagName("String_Node_Str");
    for (int i=0; i < nodeList.getLength(); i++) {
      Element doc=(Element)nodeList.item(i);
      NodeList docId=doc.getElementsByTagName("String_Node_Str");
      String id=docId.item(0).getFirstChild().getNodeValue();
      id=i + "String_Node_Str" + id.replaceAll("String_Node_Str","String_Node_Str");
      PrintWriter p=new PrintWriter(outFolder + File.separator + id+ "String_Node_Str");
      NodeList sentences=doc.getElementsByTagName("String_Node_Str");
      for (int j=0; j < sentences.getLength(); j++) {
        Node sent=sentences.item(j);
        if (j == 0) {
          p.println(sent.getTextContent());
        }
        p.print(sent.getTextContent() + "String_Node_Str");
      }
      p.close();
    }
  }
  finally {
    xmlFileStream.close();
  }
}
Program: 12289
Project: 12289
Buggy source:
private void iterateAddDomainTermFields(boolean isBoosted,String domainTermsFieldName,IndexSchema indexSchema,Document doc,List<Pair<String,Double>> filteredCandidateTerms){
  for (  Pair<String,Double> filteredTerm : filteredCandidateTerms) {
    if (filteredTerm == null) {
      continue;
    }
    if (isBoosted) {
      doc.add(indexSchema.getField(domainTermsFieldName).createField(filteredTerm.getKey(),filteredTerm.getValue().floatValue()));
    }
 else {
      doc.add(indexSchema.getField(domainTermsFieldName).createField(filteredTerm.getKey(),DEFAULT_BOOST_VALUE));
    }
  }
}

Fixed version (ground truth):
private void iterateAddDomainTermFields(boolean isBoosted,String domainTermsFieldName,IndexSchema indexSchema,Document doc,List<Pair<String,Double>> filteredCandidateTerms){
  doc.removeFields(domainTermsFieldName);
  for (  Pair<String,Double> filteredTerm : filteredCandidateTerms) {
    if (filteredTerm == null) {
      continue;
    }
    if (isBoosted) {
      doc.add(indexSchema.getField(domainTermsFieldName).createField(filteredTerm.getKey(),filteredTerm.getValue().floatValue()));
    }
 else {
      doc.add(indexSchema.getField(domainTermsFieldName).createField(filteredTerm.getKey(),DEFAULT_BOOST_VALUE));
    }
  }
}
Program: 12291
Project: 12291
Buggy source:
@Override public void handleRequestBody(SolrQueryRequest req,SolrQueryResponse rsp) throws Exception {
  log.info("String_Node_Str");
  setTopInitArgsAsInvariants(req);
  final String jatePropertyFile=req.getParams().get(JATE_PROPERTY_FILE);
  final String algorithmName=req.getParams().get(TERM_RANKING_ALGORITHM);
  final Boolean isExtraction=req.getParams().getBool(CANDIDATE_EXTRACTION);
  final String outFilePath=req.getParams().get(AppParams.OUTPUT_FILE.getParamKey());
  final Boolean isIndexTerms=req.getParams().getBool(INDEX_TERM);
  final Boolean isBoosted=req.getParams().getBool(BOOSTING);
  final Algorithm algorithm=getAlgorithm(algorithmName);
  JATEProperties properties=App.getJateProperties(jatePropertyFile);
  final SolrIndexSearcher searcher=req.getSearcher();
  if (isExtraction) {
    log.info("String_Node_Str");
    generalTRProcessor.candidateExtraction(searcher.getCore(),jatePropertyFile);
    log.info("String_Node_Str");
  }
  Map<String,String> trRunTimeParams=initialiseTRRunTimeParams(req);
  List<JATETerm> termList=generalTRProcessor.rankingAndFiltering(searcher.getCore(),jatePropertyFile,trRunTimeParams,algorithm);
  log.info(String.format("String_Node_Str",termList.size()));
  if (isExport(outFilePath)) {
    generalTRProcessor.export(termList);
  }
  if (isIndexTerms) {
    log.info("String_Node_Str");
    indexTerms(termList,properties,searcher,isBoosted,isExtraction);
    log.info("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void handleRequestBody(SolrQueryRequest req,SolrQueryResponse rsp) throws Exception {
  log.info("String_Node_Str");
  setTopInitArgsAsInvariants(req);
  final String jatePropertyFile=req.getParams().get(JATE_PROPERTY_FILE);
  final String algorithmName=req.getParams().get(TERM_RANKING_ALGORITHM);
  final Boolean isExtraction=req.getParams().getBool(CANDIDATE_EXTRACTION);
  final String outFilePath=req.getParams().get(AppParams.OUTPUT_FILE.getParamKey());
  final Boolean isIndexTerms=req.getParams().getBool(INDEX_TERM);
  final Boolean isBoosted=req.getParams().getBool(BOOSTING);
  final Algorithm algorithm=getAlgorithm(algorithmName);
  JATEProperties properties=App.getJateProperties(jatePropertyFile);
  final SolrIndexSearcher searcher=req.getSearcher();
  if (isExtraction) {
    log.info("String_Node_Str");
    generalTRProcessor.candidateExtraction(searcher.getCore(),jatePropertyFile);
    log.info("String_Node_Str");
  }
  Map<String,String> trRunTimeParams=initialiseTRRunTimeParams(req);
  List<JATETerm> termList=generalTRProcessor.rankingAndFiltering(searcher.getCore(),jatePropertyFile,trRunTimeParams,algorithm);
  log.info(String.format("String_Node_Str",termList.size()));
  if (isExport(outFilePath)) {
    generalTRProcessor.export(termList);
  }
  if (isIndexTerms) {
    log.info("String_Node_Str");
    indexTerms(termList,properties,searcher,isBoosted,isExtraction);
    searcher.getCore().getUpdateHandler().commit(new CommitUpdateCommand(req,true));
    log.info("String_Node_Str");
  }
}
Program: 12293
Project: 12293
Buggy source:
public static Terms getTermVector(int docId,String fieldname,SolrIndexSearcher solrIndexSearcher) throws JATEException {
  try {
    Terms vector=solrIndexSearcher.getLeafReader().getTermVector(docId,fieldname);
    if (vector == null)     throw new JATEException("String_Node_Str" + fieldname + "String_Node_Str");
    return vector;
  }
 catch (  IOException ioe) {
    StringBuilder sb=new StringBuilder(String.format("String_Node_Str",fieldname));
    sb.append(org.apache.commons.lang.exception.ExceptionUtils.getFullStackTrace(ioe));
    throw new JATEException(sb.toString());
  }
}

Fixed version (ground truth):
public static Terms getTermVector(int docId,String fieldname,SolrIndexSearcher solrIndexSearcher) throws JATEException {
  try {
    Terms vector=solrIndexSearcher.getLeafReader().getTermVector(docId,fieldname);
    return vector;
  }
 catch (  IOException ioe) {
    StringBuilder sb=new StringBuilder(String.format("String_Node_Str",fieldname));
    sb.append(org.apache.commons.lang.exception.ExceptionUtils.getFullStackTrace(ioe));
    throw new JATEException(sb.toString());
  }
}
Program: 12294
Project: 12294
Buggy source:
public static void copyFields(Map<String,List<CopyField>> copyFields,float boost,Document doc){
  for (  String sourceField : copyFields.keySet()) {
    List<CopyField> copyFieldList=copyFields.get(sourceField);
    for (    CopyField copyField : copyFieldList) {
      IndexableField jateField=copyField.getDestination().createField(doc.get(copyField.getSource().getName()),boost);
      doc.add(jateField);
    }
  }
}

Fixed version (ground truth):
public static void copyFields(Map<String,List<CopyField>> copyFields,float boost,Document doc){
  for (  String sourceField : copyFields.keySet()) {
    List<CopyField> copyFieldList=copyFields.get(sourceField);
    for (    CopyField copyField : copyFieldList) {
      doc.removeField(copyField.getDestination().getName());
      IndexableField jateField=copyField.getDestination().createField(doc.get(copyField.getSource().getName()),boost);
      doc.add(jateField);
    }
  }
}