nus-yam/ex-repair huggingface dataset:
Program: 185543
Project: 185543
Buggy source:
private ICompletionProposal createProposal(String replaceName,ClassNode type){
  CompletionProposal proposal=CompletionProposal.create(CompletionProposal.LOCAL_VARIABLE_REF,offset);
  proposal.setCompletion(replaceName.toCharArray());
  proposal.setReplaceRange(offset - replaceLength,getContext().completionEnd);
  proposal.setSignature(ProposalUtils.createTypeSignature(type));
  proposal.setRelevance(Relevance.HIGH.getRelevance());
  LazyJavaCompletionProposal completion=new LazyJavaCompletionProposal(proposal,getJavaContext());
  completion.setRelevance(proposal.getRelevance());
  return completion;
}

Fixed version (ground truth):
private ICompletionProposal createProposal(String replaceName,ClassNode type){
  CompletionProposal proposal=CompletionProposal.create(CompletionProposal.LOCAL_VARIABLE_REF,offset);
  proposal.setCompletion(replaceName.toCharArray());
  proposal.setReplaceRange(offset - replaceLength,getContext().completionEnd);
  proposal.setSignature(ProposalUtils.createTypeSignature(type));
  proposal.setRelevance(Relevance.HIGH.getRelevance());
  LazyJavaCompletionProposal javaProposal=new LazyJavaCompletionProposal(proposal,getJavaContext());
  javaProposal.setTriggerCharacters(ProposalUtils.VAR_TRIGGER);
  javaProposal.setRelevance(proposal.getRelevance());
  return javaProposal;
}
Program: 185545
Project: 185545
Buggy source:
private void assertNoUnknowns(String contents){
  GroovyCompilationUnit unit=createUnit("String_Node_Str",contents);
  TypeInferencingVisitorWithRequestor visitor=factory.createVisitor(unit);
  visitor.DEBUG=true;
  UnknownTypeRequestor requestor=new UnknownTypeRequestor();
  visitor.visitCompilationUnit(requestor);
  List<ASTNode> unknownNodes=requestor.getUnknownNodes();
  assertTrue("String_Node_Str" + unknownNodes,unknownNodes.isEmpty());
}

Fixed version (ground truth):
private void assertNoUnknowns(String source){
  GroovyCompilationUnit unit=createUnit("String_Node_Str",source);
  TypeInferencingVisitorWithRequestor visitor=factory.createVisitor(unit);
  visitor.DEBUG=true;
  UnknownTypeRequestor requestor=new UnknownTypeRequestor();
  visitor.visitCompilationUnit(requestor);
  List<ASTNode> unknownNodes=requestor.getUnknownNodes();
  assertTrue("String_Node_Str" + unknownNodes,unknownNodes.isEmpty());
}
Program: 185546
Project: 185546
Buggy source:
@Test public void testFieldAndPropertyWithSameName(){
  createJavaUnit("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  createJavaUnit("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
  String contents="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  int start=contents.lastIndexOf("String_Node_Str");
  int end=start + "String_Node_Str".length();
  assertType(contents,start,end,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testFieldAndPropertyWithSameName(){
  createJavaUnit("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  createJavaUnit("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
  String contents="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  assertExprType(contents,"String_Node_Str","String_Node_Str");
}
Program: 185547
Project: 185547
Buggy source:
private List<ClassNode> getMethodCallArgumentTypes(ASTNode node){
  Expression arguments=null;
  if (node instanceof MethodCallExpression) {
    arguments=((MethodCallExpression)node).getArguments();
  }
 else   if (node instanceof ConstructorCallExpression) {
    arguments=((ConstructorCallExpression)node).getArguments();
  }
 else   if (node instanceof StaticMethodCallExpression) {
    arguments=((StaticMethodCallExpression)node).getArguments();
  }
  if (arguments != null) {
    if (arguments instanceof ArgumentListExpression) {
      List<Expression> expressions=((ArgumentListExpression)arguments).getExpressions();
      if (!expressions.isEmpty()) {
        List<ClassNode> types=new ArrayList<ClassNode>(expressions.size());
        for (        Expression expression : expressions) {
          if (expression instanceof ConstantExpression && ((ConstantExpression)expression).isNullExpression()) {
            types.add(VariableScope.NULL_TYPE);
          }
 else {
            scopes.getLast().setMethodCallArgumentTypes(getMethodCallArgumentTypes(expression));
            TypeLookupResult tlr=lookupExpressionType(expression,null,false,scopes.getLast());
            types.add(tlr.type);
          }
        }
        return types;
      }
    }
    return Collections.emptyList();
  }
  return null;
}

Fixed version (ground truth):
private List<ClassNode> getMethodCallArgumentTypes(ASTNode node){
  Expression arguments=null;
  if (node instanceof MethodCallExpression) {
    arguments=((MethodCallExpression)node).getArguments();
  }
 else   if (node instanceof ConstructorCallExpression) {
    arguments=((ConstructorCallExpression)node).getArguments();
  }
 else   if (node instanceof StaticMethodCallExpression) {
    arguments=((StaticMethodCallExpression)node).getArguments();
  }
  if (arguments != null) {
    if (arguments instanceof ArgumentListExpression) {
      List<Expression> expressions=((ArgumentListExpression)arguments).getExpressions();
      if (!expressions.isEmpty()) {
        List<ClassNode> types=new ArrayList<ClassNode>(expressions.size());
        for (        Expression expression : expressions) {
          if (expression instanceof ConstantExpression && ((ConstantExpression)expression).isNullExpression()) {
            types.add(VariableScope.NULL_TYPE);
          }
 else {
            scopes.getLast().setMethodCallArgumentTypes(getMethodCallArgumentTypes(expression));
            TypeLookupResult tlr;
            if (!(expression instanceof MethodCallExpression)) {
              tlr=lookupExpressionType(expression,null,false,scopes.getLast());
            }
 else {
              MethodCallExpression call=(MethodCallExpression)expression;
              tlr=lookupExpressionType(call.getObjectExpression(),null,false,scopes.getLast());
              tlr=lookupExpressionType(call.getMethod(),tlr.type,call.getObjectExpression() instanceof ClassExpression,scopes.getLast());
            }
            types.add(tlr.type);
          }
        }
        return types;
      }
    }
    return Collections.emptyList();
  }
  return null;
}
Program: 185548
Project: 185548
Buggy source:
protected boolean isCompatibleCategoryMethod(MethodNode method,ClassNode firstArgumentType){
  if (method.isStatic()) {
    Parameter[] paramters=method.getParameters();
    if (paramters != null && paramters.length > 0 && SimpleTypeLookup.isTypeCompatible(firstArgumentType,paramters[0].getType()) != Boolean.FALSE) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
protected boolean isCompatibleCategoryMethod(MethodNode method,ClassNode firstArgumentType){
  if (method.isStatic()) {
    Parameter[] paramters=method.getParameters();
    if (paramters != null && paramters.length > 0) {
      ClassNode parameterType=paramters[0].getType();
      if (VariableScope.DGSM_CLASS_NODE.equals(method.getDeclaringClass())) {
        parameterType=VariableScope.newClassClassNode(parameterType);
      }
      if (isTypeCompatible(firstArgumentType,parameterType)) {
        return true;
      }
    }
  }
  return false;
}
Program: 185549
Project: 185549
Buggy source:
protected boolean isDefaultGroovyMethod(MethodNode method){
  return VariableScope.ALL_DEFAULT_CATEGORIES.contains(method.getDeclaringClass());
}

Fixed version (ground truth):
protected final boolean isDefaultGroovyMethod(MethodNode method){
  return VariableScope.ALL_DEFAULT_CATEGORIES.contains(method.getDeclaringClass());
}
Program: 185550
Project: 185550
Buggy source:
private void setCompletionToken(char[][] tokens,int sourceStart,int sourceEnd,long[] sourcePositions){
  setCompletionToken(tokens,sourceStart,sourceEnd,sourcePositions,true);
}

Fixed version (ground truth):
private void setCompletionToken(char[][] tokens,int sourceStart,int sourceEnd,long[] sourcePositions){
  setCompletionToken(tokens,sourceStart,sourceEnd,sourcePositions,tokens.length > 0 && tokens[tokens.length - 1].length > 0);
}
Program: 185551
Project: 185551
Buggy source:
synchronized IPackageBinding getPackageBinding(org.eclipse.jdt.internal.compiler.lookup.PackageBinding packageBinding){
  if (packageBinding == null) {
    return null;
  }
  IPackageBinding binding=(IPackageBinding)this.bindingTables.compilerBindingsToASTBindings.get(packageBinding);
  if (binding != null) {
    return binding;
  }
  binding=new PackageBinding(packageBinding,this);
  this.bindingTables.compilerBindingsToASTBindings.put(packageBinding,binding);
  return binding;
}

Fixed version (ground truth):
synchronized IPackageBinding getPackageBinding(org.eclipse.jdt.internal.compiler.lookup.PackageBinding packageBinding){
  if (packageBinding == null || packageBinding instanceof ProblemPackageBinding) {
    return null;
  }
  IPackageBinding binding=(IPackageBinding)this.bindingTables.compilerBindingsToASTBindings.get(packageBinding);
  if (binding != null) {
    return binding;
  }
  binding=new PackageBinding(packageBinding,this);
  this.bindingTables.compilerBindingsToASTBindings.put(packageBinding,binding);
  return binding;
}
Program: 185552
Project: 185552
Buggy source:
@Override public void visitTernaryExpression(final TernaryExpression expression){
  Map<VariableExpression,List<ClassNode>> oldTracker=pushAssignmentTracking();
  pushTemporaryTypeInfo();
  expression.getBooleanExpression().visit(this);
  Expression trueExpression=expression.getTrueExpression();
  Expression falseExpression=expression.getFalseExpression();
  trueExpression.visit(this);
  temporaryIfBranchTypeInformation.pop();
  falseExpression.visit(this);
  ClassNode resultType;
  if (isNullConstant(trueExpression) || isNullConstant(falseExpression)) {
    if (currentBinaryExpression != null && currentBinaryExpression.getRightExpression() == expression) {
      resultType=getType(currentBinaryExpression.getLeftExpression());
    }
 else     if (isNullConstant(trueExpression) && isNullConstant(falseExpression)) {
      resultType=OBJECT_TYPE;
    }
 else     if (isNullConstant(trueExpression)) {
      resultType=wrapTypeIfNecessary(getType(falseExpression));
    }
 else {
      resultType=wrapTypeIfNecessary(getType(trueExpression));
    }
  }
 else {
    final ClassNode typeOfTrue=getType(trueExpression);
    final ClassNode typeOfFalse=getType(falseExpression);
    resultType=lowestUpperBound(typeOfTrue,typeOfFalse);
  }
  storeType(expression,resultType);
  popAssignmentTracking(oldTracker);
}

Fixed version (ground truth):
@Override public void visitTernaryExpression(final TernaryExpression expression){
  Map<VariableExpression,List<ClassNode>> oldTracker=pushAssignmentTracking();
  pushTemporaryTypeInfo();
  expression.getBooleanExpression().visit(this);
  Expression trueExpression=expression.getTrueExpression();
  Expression falseExpression=expression.getFalseExpression();
  trueExpression.visit(this);
  final ClassNode typeOfTrue=findCurrentInstanceOfClass(trueExpression,getType(trueExpression));
  temporaryIfBranchTypeInformation.pop();
  falseExpression.visit(this);
  ClassNode resultType;
  if (isNullConstant(trueExpression) || isNullConstant(falseExpression)) {
    if (currentBinaryExpression != null && currentBinaryExpression.getRightExpression() == expression) {
      resultType=getType(currentBinaryExpression.getLeftExpression());
    }
 else     if (isNullConstant(trueExpression) && isNullConstant(falseExpression)) {
      resultType=OBJECT_TYPE;
    }
 else     if (isNullConstant(trueExpression)) {
      resultType=wrapTypeIfNecessary(getType(falseExpression));
    }
 else {
      resultType=wrapTypeIfNecessary(getType(trueExpression));
    }
  }
 else {
    final ClassNode typeOfFalse=getType(falseExpression);
    resultType=lowestUpperBound(typeOfTrue,typeOfFalse);
  }
  storeType(expression,resultType);
  popAssignmentTracking(oldTracker);
}
Program: 185553
Project: 185553
Buggy source:
/** 
 * Crude way to determine it... basically check for a folder called 'grails-app'.  The reason we need to know is because of the extra transform that will run if it is a grails-app (tagging domain classes).
 */
private static boolean isProbablyGrailsProject(IProject project){
  try {
    IFolder folder=project.getFolder("String_Node_Str");
    return folder.exists();
  }
 catch (  Exception e) {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Crude way to determine it... check for a folder called 'grails-app'. The reason we need to know is because of the extra transform that will run if it is a grails-app (tagging domain classes).
 */
private static boolean isProbablyGrailsProject(IProject project){
  try {
    IFolder folder=project.getFolder("String_Node_Str");
    return folder.exists();
  }
 catch (  Exception e) {
    return false;
  }
}
Program: 185555
Project: 185555
Buggy source:
private static String pathToString(IPath path,IProject project){
  String realLocation=null;
  if (path != null) {
    String prefix=path.segment(0);
    if (prefix.equals(project.getName())) {
      if (path.segmentCount() == 1) {
        IPath rawPath=project.getRawLocation();
        if (rawPath == null) {
          System.err.println("String_Node_Str" + project);
        }
 else {
          realLocation=project.getRawLocation().toOSString();
        }
      }
 else {
        IPath rawLocation=project.getFile(path.removeFirstSegments(1)).getRawLocation();
        if (rawLocation != null) {
          realLocation=rawLocation.toOSString();
        }
      }
    }
 else {
      realLocation=path.toOSString();
    }
  }
  return realLocation;
}

Fixed version (ground truth):
private static String pathToString(IPath path,IProject project){
  String realLocation=null;
  if (path != null) {
    String prefix=path.segment(0);
    if (prefix.equals(project.getName())) {
      if (path.segmentCount() == 1) {
        IPath rawPath=project.getRawLocation();
        if (rawPath == null) {
          Util.log(null,"String_Node_Str" + project + "String_Node_Str");
        }
 else {
          realLocation=project.getRawLocation().toOSString();
        }
      }
 else {
        IPath rawLocation=project.getFile(path.removeFirstSegments(1)).getRawLocation();
        if (rawLocation != null) {
          realLocation=rawLocation.toOSString();
        }
      }
    }
 else {
      realLocation=path.toOSString();
    }
  }
  return realLocation;
}
Program: 185556
Project: 185556
Buggy source:
/** 
 * Configure an options map (usually retrieved from a CompilerOptions object) based on the project. If anything goes wrong it will configure the options to just build java.
 */
public static void configureOptionsBasedOnNature(Map<String,String> optionMap,IJavaProject javaProject){
  IProject project=javaProject.getProject();
  try {
    if (isGroovyNaturedProject(project)) {
      optionMap.put(CompilerOptions.OPTIONG_BuildGroovyFiles,CompilerOptions.ENABLED);
      setGroovyClasspath(optionMap,javaProject);
      if (isProbablyGrailsProject(project)) {
        optionMap.put(CompilerOptions.OPTIONG_GroovyFlags,Integer.toString(IsGrails));
      }
 else {
        optionMap.put(CompilerOptions.OPTIONG_GroovyFlags,"String_Node_Str");
      }
    }
 else {
      optionMap.put(CompilerOptions.OPTIONG_BuildGroovyFiles,CompilerOptions.DISABLED);
      optionMap.put(CompilerOptions.OPTIONG_GroovyFlags,"String_Node_Str");
    }
  }
 catch (  CoreException e) {
    e.printStackTrace();
    optionMap.put(CompilerOptions.OPTIONG_BuildGroovyFiles,CompilerOptions.DISABLED);
    optionMap.put(CompilerOptions.OPTIONG_GroovyFlags,"String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Configure an options map (usually retrieved from a CompilerOptions object) based on the project. If anything goes wrong it will configure the options to just build java.
 */
public static void configureOptionsBasedOnNature(Map<String,String> optionMap,IJavaProject javaProject){
  try {
    IProject project=javaProject.getProject();
    if (isGroovyNaturedProject(project)) {
      optionMap.put(CompilerOptions.OPTIONG_BuildGroovyFiles,CompilerOptions.ENABLED);
      setGroovyClasspath(optionMap,javaProject);
      if (isProbablyGrailsProject(project)) {
        optionMap.put(CompilerOptions.OPTIONG_GroovyFlags,Integer.toString(IsGrails));
      }
 else {
        optionMap.put(CompilerOptions.OPTIONG_GroovyFlags,"String_Node_Str");
      }
    }
 else {
      optionMap.put(CompilerOptions.OPTIONG_BuildGroovyFiles,CompilerOptions.DISABLED);
      optionMap.put(CompilerOptions.OPTIONG_GroovyFlags,"String_Node_Str");
    }
  }
 catch (  CoreException e) {
    Util.log(e,"String_Node_Str");
    optionMap.put(CompilerOptions.OPTIONG_BuildGroovyFiles,CompilerOptions.DISABLED);
    optionMap.put(CompilerOptions.OPTIONG_GroovyFlags,"String_Node_Str");
  }
}
Program: 185557
Project: 185557
Buggy source:
public static void setGroovyClasspath(Map<String,String> optionMap,IJavaProject javaProject){
  IFile file=javaProject.getProject().getFile("String_Node_Str");
  if (file.exists()) {
    try {
      PropertyResourceBundle prb=new PropertyResourceBundle(file.getContents());
      Enumeration<String> e=prb.getKeys();
      while (e.hasMoreElements()) {
        String k=e.nextElement();
        String v=(String)prb.getObject(k);
        v=fixup(v,javaProject);
        if (k.equals(CompilerOptions.OPTIONG_GroovyClassLoaderPath)) {
          optionMap.put(CompilerOptions.OPTIONG_GroovyClassLoaderPath,v);
        }
      }
    }
 catch (    IOException ioe) {
      System.err.println("String_Node_Str");
      ioe.printStackTrace();
    }
catch (    CoreException ce) {
      System.err.println("String_Node_Str");
      ce.printStackTrace();
    }
catch (    Throwable t) {
      System.err.println("String_Node_Str");
      t.printStackTrace();
    }
  }
 else {
    try {
      String classpath=calculateClasspath(javaProject);
      optionMap.put(CompilerOptions.OPTIONG_GroovyClassLoaderPath,classpath);
    }
 catch (    Throwable t) {
      System.err.println("String_Node_Str");
      t.printStackTrace();
    }
  }
  IProject project=javaProject.getProject();
  try {
    IPath defaultOutputPath=javaProject.getOutputLocation();
    String defaultOutputLocation=pathToString(defaultOutputPath,project);
    optionMap.put(CompilerOptions.OPTIONG_GroovyExcludeGlobalASTScan,defaultOutputLocation);
  }
 catch (  Throwable t) {
    System.err.println("String_Node_Str");
    t.printStackTrace();
  }
  optionMap.put(CompilerOptions.OPTIONG_GroovyProjectName,project.getName());
}

Fixed version (ground truth):
public static void setGroovyClasspath(Map<String,String> optionMap,IJavaProject javaProject){
  IFile file=javaProject.getProject().getFile("String_Node_Str");
  if (file.exists()) {
    try {
      PropertyResourceBundle prb=new PropertyResourceBundle(file.getContents());
      for (      String k : prb.keySet()) {
        String v=fixup(prb.getString(k),javaProject);
        if (k.equals(CompilerOptions.OPTIONG_GroovyClassLoaderPath)) {
          optionMap.put(CompilerOptions.OPTIONG_GroovyClassLoaderPath,v);
        }
      }
    }
 catch (    Throwable t) {
      Util.log(t,"String_Node_Str");
    }
  }
 else {
    try {
      String classpath=calculateClasspath(javaProject);
      optionMap.put(CompilerOptions.OPTIONG_GroovyClassLoaderPath,classpath);
    }
 catch (    Throwable t) {
      Util.log(t,"String_Node_Str");
    }
  }
  IProject project=javaProject.getProject();
  try {
    IPath defaultOutputPath=javaProject.getOutputLocation();
    String defaultOutputLocation=pathToString(defaultOutputPath,project);
    optionMap.put(CompilerOptions.OPTIONG_GroovyExcludeGlobalASTScan,defaultOutputLocation);
  }
 catch (  Throwable t) {
    Util.log(t,"String_Node_Str");
  }
  optionMap.put(CompilerOptions.OPTIONG_GroovyProjectName,project.getName());
}
Program: 185563
Project: 185563
Buggy source:
private void gatherParameters(ClassNode declaringType,boolean[] foundParameterNumbers){
  if (declaringType == null) {
    return;
  }
  declaringType=findWrappedNode(declaringType.redirect());
  List<MethodNode> methods=declaringType.getMethods(String.valueOf(name));
  for (  MethodNode method : methods) {
    method=method.getOriginal();
    foundParameterNumbers[Math.min(method.getParameters().length,MAX_PARAMS)]=true;
  }
  gatherParameters(declaringType.getSuperClass(),foundParameterNumbers);
  for (  ClassNode iface : declaringType.getInterfaces()) {
    gatherParameters(iface,foundParameterNumbers);
  }
}

Fixed version (ground truth):
private void gatherParameters(ClassNode declaringType,boolean[] foundParameterNumbers){
  if (declaringType == null) {
    return;
  }
  declaringType=findWrappedNode(declaringType.redirect());
  List<MethodNode> methods=declaringType.getMethods(name);
  for (  MethodNode method : methods) {
    method=method.getOriginal();
    foundParameterNumbers[Math.min(method.getParameters().length,MAX_PARAMS)]=true;
  }
  gatherParameters(declaringType.getSuperClass(),foundParameterNumbers);
  for (  ClassNode iface : declaringType.getInterfaces()) {
    gatherParameters(iface,foundParameterNumbers);
  }
}
Program: 185564
Project: 185564
Buggy source:
/** 
 * @return finds the number of parameters in the method reference/declaration currently being analyzed.
 */
private int findNumberOfParameters(ASTNode node,TypeLookupResult result){
  return node instanceof MethodNode && ((MethodNode)node).getParameters() != null ? ((MethodNode)node).getParameters().length : Math.max(0,result.scope.getMethodCallNumberOfArguments());
}

Fixed version (ground truth):
/** 
 * @return finds the number of parameters in the method reference/declaration currently being analyzed.
 */
private int findNumberOfParameters(ASTNode node,TypeLookupResult result){
  return (node instanceof MethodNode && ((MethodNode)node).getParameters() != null) ? ((MethodNode)node).getParameters().length : Math.max(0,result.scope.getMethodCallNumberOfArguments());
}
Program: 185565
Project: 185565
Buggy source:
/** 
 * Attempt to convert from a   {@link JDTClassNode} to a {@link ClassNode} in order to check default parameters
 */
private ClassNode findWrappedNode(ClassNode declaringType){
  ClassNode wrappedNode=null;
  if (declaringType instanceof JDTClassNode) {
    ReferenceBinding binding=((JDTClassNode)declaringType).getJdtBinding();
    if (binding instanceof SourceTypeBinding) {
      SourceTypeBinding sourceTypeBinding=(SourceTypeBinding)binding;
      if (sourceTypeBinding.scope != null) {
        TypeDeclaration typeDeclaration=sourceTypeBinding.scope.referenceContext;
        if (typeDeclaration instanceof GroovyTypeDeclaration) {
          GroovyTypeDeclaration groovyTypeDeclaration=(GroovyTypeDeclaration)typeDeclaration;
          wrappedNode=groovyTypeDeclaration.getClassNode();
        }
      }
    }
  }
  return wrappedNode == null ? declaringType : wrappedNode;
}

Fixed version (ground truth):
/** 
 * Converts from a   {@link JDTClassNode} to a {@link ClassNode} in order tocheck default parameters.
 */
private ClassNode findWrappedNode(ClassNode declaringType){
  ClassNode wrappedNode=null;
  if (declaringType instanceof JDTClassNode) {
    ReferenceBinding binding=((JDTClassNode)declaringType).getJdtBinding();
    if (binding instanceof SourceTypeBinding) {
      SourceTypeBinding sourceTypeBinding=(SourceTypeBinding)binding;
      if (sourceTypeBinding.scope != null) {
        TypeDeclaration typeDeclaration=sourceTypeBinding.scope.referenceContext;
        if (typeDeclaration instanceof GroovyTypeDeclaration) {
          GroovyTypeDeclaration groovyTypeDeclaration=(GroovyTypeDeclaration)typeDeclaration;
          wrappedNode=groovyTypeDeclaration.getClassNode();
        }
      }
    }
  }
  return wrappedNode == null ? declaringType : wrappedNode;
}
Program: 185567
Project: 185567
Buggy source:
/** 
 * check to see if this requestor has something to do with refactoring, if so, we always want an accurate match otherwise we get complaints in the refactoring wizard of "possible matches"
 */
private boolean shouldAlwaysBeAccurate(){
  return requestor.getClass().getPackage().getName().indexOf("String_Node_Str") != -1;
}

Fixed version (ground truth):
/** 
 * Checks to see if this requestor has something to do with refactoring, if so, we always want an accurate match otherwise we get complaints in the refactoring wizard of "possible matches"
 */
private boolean shouldAlwaysBeAccurate(){
  return requestor.getClass().getPackage().getName().indexOf("String_Node_Str") != -1;
}
Program: 185570
Project: 185570
Buggy source:
private boolean matchOnName(ClassNode declaringType){
  if (declaringType == null) {
    return false;
  }
  String declaringTypeName=declaringType.getName();
  if ((declaringTypeName.equals("String_Node_Str") && declaringType.getDeclaredMethods(String.valueOf(name)).size() == 0)) {
    return false;
  }
  if (declaringQualifiedName == null || declaringQualifiedName.equals("String_Node_Str")) {
    return true;
  }
  declaringTypeName=declaringTypeName.replace('$','.');
  Boolean maybeMatch=cachedDeclaringNameMatches.get(declaringType);
  if (maybeMatch != null) {
    return maybeMatch;
  }
  if (declaringTypeName.equals(declaringQualifiedName)) {
    cachedDeclaringNameMatches.put(declaringType,true);
    return true;
  }
 else {
    maybeMatch=matchOnName(declaringType.getSuperClass());
    if (!maybeMatch) {
      for (      ClassNode iface : declaringType.getInterfaces()) {
        maybeMatch=matchOnName(iface);
        if (maybeMatch) {
          break;
        }
      }
    }
    cachedDeclaringNameMatches.put(declaringType,maybeMatch);
    return maybeMatch;
  }
}

Fixed version (ground truth):
private boolean matchOnName(ClassNode declaringType){
  if (declaringType == null) {
    return false;
  }
  String declaringTypeName=declaringType.getName();
  if (declaringTypeName.equals("String_Node_Str") && declaringType.getDeclaredMethods(name).isEmpty()) {
    return false;
  }
  if (declaringQualifiedName == null || declaringQualifiedName.equals("String_Node_Str")) {
    return true;
  }
  declaringTypeName=declaringTypeName.replace('$','.');
  Boolean maybeMatch=cachedDeclaringNameMatches.get(declaringType);
  if (maybeMatch != null) {
    return maybeMatch;
  }
  if (declaringTypeName.equals(declaringQualifiedName)) {
    cachedDeclaringNameMatches.put(declaringType,true);
    return true;
  }
 else {
    maybeMatch=matchOnName(declaringType.getSuperClass());
    if (!maybeMatch) {
      for (      ClassNode iface : declaringType.getInterfaces()) {
        maybeMatch=matchOnName(iface);
        if (maybeMatch) {
          break;
        }
      }
    }
    cachedDeclaringNameMatches.put(declaringType,maybeMatch);
    return maybeMatch;
  }
}
Program: 185579
Project: 185579
Buggy source:
public VisitStatus acceptASTNode(ASTNode node,TypeLookupResult result,IJavaElement enclosingElement){
  try {
    if (node instanceof PackageNode) {
      String name=((PackageNode)node).getName();
      if (name.startsWith(packageName)) {
        notifyRequestor(enclosingElement,node.getStart());
      }
    }
 else     if (node instanceof ImportNode) {
      ImportNode i=((ImportNode)node);
      String name=i.getClassName();
      if (i.isStar() && !i.isStatic())       name=i.getPackageName();
      if (name.startsWith(packageName)) {
        notifyRequestor(enclosingElement,i.getType().getStart());
      }
    }
 else     if (node instanceof ClassNode && enclosingElement.getElementType() != IJavaElement.IMPORT_DECLARATION) {
      String name=((ClassNode)node).getName();
      if (name.startsWith(packageName) && name.length() <= node.getLength()) {
        if (enclosingElement instanceof ISourceReference) {
          ISourceRange range=((ISourceReference)enclosingElement).getSourceRange();
          if (node.getStart() >= range.getOffset() && node.getEnd() <= (range.getOffset() + range.getLength())) {
            notifyRequestor(enclosingElement,node.getStart());
          }
        }
      }
    }
  }
 catch (  CoreException e) {
    Util.log(e,"String_Node_Str" + node.getClass().getSimpleName() + "String_Node_Str"+ enclosingElement);
  }
  return VisitStatus.CONTINUE;
}

Fixed version (ground truth):
public VisitStatus acceptASTNode(ASTNode node,TypeLookupResult result,IJavaElement enclosingElement){
  try {
    if (node instanceof PackageNode) {
      String name=((PackageNode)node).getName();
      if (name.startsWith(packageName)) {
        notifyRequestor(enclosingElement,node.getStart());
      }
    }
 else     if (node instanceof ImportNode) {
      ImportNode i=((ImportNode)node);
      String name=i.getClassName();
      if (i.isStar() && !i.isStatic())       name=i.getPackageName();
      if (name.startsWith(packageName)) {
        notifyRequestor(enclosingElement,i.getType().getStart());
      }
    }
 else     if (node instanceof ClassNode && enclosingElement.getElementType() != IJavaElement.IMPORT_DECLARATION) {
      String name=((ClassNode)node).getName();
      if (name.startsWith(packageName) && name.length() <= node.getLength()) {
        if (enclosingElement instanceof ISourceReference) {
          ISourceRange range=((ISourceReference)enclosingElement).getSourceRange();
          if (node.getStart() >= range.getOffset() && node.getLength() < range.getLength()) {
            notifyRequestor(enclosingElement,node.getStart());
          }
        }
      }
    }
  }
 catch (  CoreException e) {
    Util.log(e,"String_Node_Str" + node.getClass().getSimpleName() + "String_Node_Str"+ enclosingElement);
  }
  return VisitStatus.CONTINUE;
}
Program: 185580
Project: 185580
Buggy source:
@Override public void visitPackage(PackageNode node){
  if (node != null) {
    visitAnnotations(node);
    TypeLookupResult result=new TypeLookupResult(null,null,node,TypeConfidence.EXACT,null);
    VisitStatus status=notifyRequestor(node,requestor,result);
    if (status == VisitStatus.STOP_VISIT) {
      throw new VisitCompleted(status);
    }
  }
}

Fixed version (ground truth):
@Override public void visitPackage(PackageNode node){
  if (node != null) {
    visitAnnotations(node);
    IJavaElement oldEnclosing=enclosingElement;
    enclosingElement=unit.getPackageDeclaration(node.getName().substring(0,node.getName().length() - 1));
    try {
      TypeLookupResult result=new TypeLookupResult(null,null,node,TypeConfidence.EXACT,null);
      VisitStatus status=notifyRequestor(node,requestor,result);
      if (status == VisitStatus.STOP_VISIT) {
        throw new VisitCompleted(status);
      }
    }
  finally {
      enclosingElement=oldEnclosing;
    }
  }
}
Program: 185586
Project: 185586
Buggy source:
private void processClassVariable(VariableExpression expression){
  String name=expression.getName();
  if (passingParams && controller.isInScriptBody()) {
    MethodVisitor mv=controller.getMethodVisitor();
    mv.visitTypeInsn(NEW,"String_Node_Str");
    mv.visitInsn(DUP);
    loadThisOrOwner();
    mv.visitLdcInsn(name);
    mv.visitMethodInsn(INVOKESPECIAL,"String_Node_Str","String_Node_Str","String_Node_Str",false);
  }
 else {
    PropertyExpression pexp=new PropertyExpression(new VariableExpression("String_Node_Str",ClassHelper.DYNAMIC_TYPE),name);
    pexp.getObjectExpression().setSourcePosition(expression);
    pexp.getProperty().setSourcePosition(expression);
    pexp.setImplicitThis(true);
    visitPropertyExpression(pexp);
  }
}

Fixed version (ground truth):
private void processClassVariable(VariableExpression expression){
  if (passingParams && controller.isInScriptBody()) {
    MethodVisitor mv=controller.getMethodVisitor();
    mv.visitTypeInsn(NEW,"String_Node_Str");
    mv.visitInsn(DUP);
    loadThisOrOwner();
    mv.visitLdcInsn(expression.getName());
    mv.visitMethodInsn(INVOKESPECIAL,"String_Node_Str","String_Node_Str","String_Node_Str",false);
  }
 else {
    PropertyExpression pexp=new PropertyExpression(new VariableExpression("String_Node_Str"),expression.getName());
    pexp.getObjectExpression().setSourcePosition(expression);
    pexp.getProperty().setSourcePosition(expression);
    pexp.setImplicitThis(true);
    visitPropertyExpression(pexp);
  }
}
Program: 185588
Project: 185588
Buggy source:
private void processClassVariable(VariableExpression expression){
  String name=expression.getName();
  if (passingParams && controller.isInScriptBody()) {
    MethodVisitor mv=controller.getMethodVisitor();
    mv.visitTypeInsn(NEW,"String_Node_Str");
    mv.visitInsn(DUP);
    loadThisOrOwner();
    mv.visitLdcInsn(name);
    mv.visitMethodInsn(INVOKESPECIAL,"String_Node_Str","String_Node_Str","String_Node_Str",false);
  }
 else {
    PropertyExpression pexp=new PropertyExpression(new VariableExpression("String_Node_Str",ClassHelper.DYNAMIC_TYPE),name);
    pexp.getObjectExpression().setSourcePosition(expression);
    pexp.getProperty().setSourcePosition(expression);
    pexp.setImplicitThis(true);
    visitPropertyExpression(pexp);
  }
}

Fixed version (ground truth):
private void processClassVariable(VariableExpression expression){
  if (passingParams && controller.isInScriptBody()) {
    MethodVisitor mv=controller.getMethodVisitor();
    mv.visitTypeInsn(NEW,"String_Node_Str");
    mv.visitInsn(DUP);
    loadThisOrOwner();
    mv.visitLdcInsn(expression.getName());
    mv.visitMethodInsn(INVOKESPECIAL,"String_Node_Str","String_Node_Str","String_Node_Str",false);
  }
 else {
    PropertyExpression pexp=new PropertyExpression(new VariableExpression("String_Node_Str",ClassHelper.DYNAMIC_TYPE),expression.getName());
    pexp.getObjectExpression().setSourcePosition(expression);
    pexp.getProperty().setSourcePosition(expression);
    pexp.setImplicitThis(true);
    visitPropertyExpression(pexp);
  }
}
Program: 185593
Project: 185593
Buggy source:
private static String stateString(int bundleState){
switch (bundleState) {
case Bundle.ACTIVE:
    return "String_Node_Str";
case Bundle.UNINSTALLED:
  return "String_Node_Str";
case Bundle.INSTALLED:
return "String_Node_Str";
case Bundle.RESOLVED:
return "String_Node_Str";
case Bundle.STARTING:
return "String_Node_Str";
case Bundle.STOPPING:
return "String_Node_Str";
}
return "String_Node_Str" + bundleState + "String_Node_Str";
}

Fixed version (ground truth):
private static String stateString(int bundleState){
switch (bundleState) {
case Bundle.UNINSTALLED:
    return "String_Node_Str";
case Bundle.INSTALLED:
  return "String_Node_Str";
case Bundle.RESOLVED:
return "String_Node_Str";
case Bundle.STARTING:
return "String_Node_Str";
case Bundle.STOPPING:
return "String_Node_Str";
case Bundle.ACTIVE:
return "String_Node_Str";
}
return "String_Node_Str" + bundleState + "String_Node_Str";
}
Program: 185594
Project: 185594
Buggy source:
private void refreshPackages(Bundle... bundles){
  final CountDownLatch latch=new CountDownLatch(1);
  bundleContext.getBundle(0).adapt(FrameworkWiring.class).refreshBundles(Arrays.asList(bundles),new FrameworkListener(){
    public void frameworkEvent(    FrameworkEvent event){
      if (event.getType() == FrameworkEvent.PACKAGES_REFRESHED) {
        latch.countDown();
      }
    }
  }
);
  try {
    latch.await(5,TimeUnit.SECONDS);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  dump(bundles);
}

Fixed version (ground truth):
private void refreshPackages(Collection<Bundle> bundles){
  FrameworkWiring wiring=bundleContext.getBundle(0).adapt(FrameworkWiring.class);
  System.out.println("String_Node_Str");
  dump(wiring.getDependencyClosure(bundles));
  final CountDownLatch latch=new CountDownLatch(1);
  wiring.refreshBundles(bundles,new FrameworkListener(){
    public void frameworkEvent(    FrameworkEvent event){
      if (event.getType() == FrameworkEvent.PACKAGES_REFRESHED) {
        latch.countDown();
      }
    }
  }
);
  try {
    latch.await(5,TimeUnit.SECONDS);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 185595
Project: 185595
Buggy source:
public void stop(BundleContext bundleContext) throws Exception {
  this.bundleContext.removeServiceListener(serviceListener);
  this.bundleContext=null;
  serviceListener=null;
  initialized=false;
}

Fixed version (ground truth):
public void stop(BundleContext bundleContext) throws Exception {
  if (serviceListener != null) {
    bundleContext.removeServiceListener(serviceListener);
  }
  this.bundleContext=null;
  serviceListener=null;
  initialized=false;
}
Program: 185597
Project: 185597
Buggy source:
private void dump(Bundle... bundles){
  for (  Bundle b : bundles) {
    String message=b.getBundleId() + "String_Node_Str" + b.getVersion()+ "String_Node_Str"+ stateString(b.getState());
    System.out.println(message);
  }
}

Fixed version (ground truth):
private void dump(Collection<Bundle> bundles){
  for (  Bundle b : bundles) {
    System.out.println(String.format("String_Node_Str",b.getBundleId(),b.getSymbolicName(),b.getVersion(),stateString(b.getState())));
  }
}
Program: 185598
Project: 185598
Buggy source:
private int getDeclarationOffset(){
  if (declarationExpression.getEnd() > 0) {
    return declarationExpression.getStart();
  }
  if (!declarationExpression.getAnnotations().isEmpty()) {
    return declarationExpression.getAnnotations().get(0).getStart() - 1;
  }
  throw new IllegalStateException("String_Node_Str" + declarationExpression.getText());
}

Fixed version (ground truth):
private int getDeclarationOffset(){
  if (declarationExpression.getEnd() > 0) {
    return declarationExpression.getStart();
  }
  if (!declarationExpression.getAnnotations().isEmpty()) {
    return declarationExpression.getAnnotations().get(0).getStart() - 1;
  }
  throw new IllegalStateException("String_Node_Str" + variableExpressionInDeclaration.getLineNumber());
}
Program: 185599
Project: 185599
Buggy source:
@Override public String[] getClasspath(ILaunchConfiguration configuration) throws CoreException {
  String[] classpath=super.getClasspath(configuration);
  List<String> newClasspath=Arrays.asList(classpath);
  try {
    newClasspath.addAll(getExtraClasspathElements());
  }
 catch (  IOException e) {
    GroovyCore.logException("String_Node_Str",e);
  }
  return newClasspath.toArray(new String[0]);
}

Fixed version (ground truth):
@Override public String[] getClasspath(ILaunchConfiguration configuration) throws CoreException {
  String[] classpath=super.getClasspath(configuration);
  boolean jline=false, commons_cli=false;
  for (  String entry : classpath) {
    if (entry.matches("String_Node_Str")) {
      jline=true;
    }
 else     if (entry.matches("String_Node_Str")) {
      commons_cli=true;
    }
  }
  if (!jline) {
    IPath path=CompilerUtils.getJarInGroovyLib("String_Node_Str");
    if (path != null) {
      classpath=(String[])ArrayUtils.add(classpath,path.toOSString());
    }
  }
  if (!commons_cli) {
    IPath path=CompilerUtils.getJarInGroovyLib("String_Node_Str");
    if (path != null) {
      classpath=(String[])ArrayUtils.add(classpath,path.toOSString());
    }
  }
  return classpath;
}
Program: 185600
Project: 185600
Buggy source:
private void launchGroovy(IJavaProject project,String mode){
  String className=org.codehaus.groovy.tools.shell.Main.class.getName();
  try {
    String launchName=getLaunchManager().generateLaunchConfigurationName(project.getProject().getName());
    ILaunchConfigurationWorkingCopy launchConfig=getGroovyLaunchConfigType().newInstance(null,launchName);
    launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME,className);
    launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME,project.getElementName());
    launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS,"String_Node_Str");
    List<String> classpath=new ArrayList<String>(Arrays.asList(JavaRuntime.computeDefaultRuntimeClassPath(project)));
    try {
      classpath.addAll(0,GroovyShellLaunchDelegate.getExtraClasspathElements());
    }
 catch (    Exception e) {
      GroovyCore.logException("String_Node_Str",e);
    }
    launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH,classpath);
    DebugUITools.launch(launchConfig,mode);
  }
 catch (  Exception e) {
    GroovyPlugin.getDefault().logError("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private void launchGroovy(IJavaProject project,String mode){
  try {
    String launchName=getLaunchManager().generateLaunchConfigurationName(project.getProject().getName());
    ILaunchConfigurationWorkingCopy launchConfig=getGroovyLaunchConfigType().newInstance(null,launchName);
    launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME,Main.class.getName());
    launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME,project.getElementName());
    launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS,"String_Node_Str");
    List<String> classpath=new ArrayList<String>(Arrays.asList(JavaRuntime.computeDefaultRuntimeClassPath(project)));
    launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH,classpath);
    DebugUITools.launch(launchConfig,mode);
  }
 catch (  Exception e) {
    GroovyPlugin.getDefault().logError("String_Node_Str",e);
  }
}
Program: 185601
Project: 185601
Buggy source:
/** 
 * This is a convenince method for getting the Launch Manager from the Debug plugin.
 * @return Returns the default Eclipse launch manager.
 */
public static ILaunchManager getLaunchManager(){
  return DebugPlugin.getDefault().getLaunchManager();
}

Fixed version (ground truth):
/** 
 * This is a convenince method for getting the Launch Manager from the Debug plugin.
 * @return the default Eclipse launch manager
 */
public static ILaunchManager getLaunchManager(){
  return DebugPlugin.getDefault().getLaunchManager();
}
Program: 185603
Project: 185603
Buggy source:
private boolean isArgument(Expression expr,List<? extends Expression> args){
  if (args != null && !args.isEmpty()) {
    for (    Expression arg : args) {
      if (arg instanceof NamedArgumentListExpression) {
        return isArgument(expr,((NamedArgumentListExpression)arg).getMapEntryExpressions());
      }
      if (arg == expr) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean isArgument(Expression expr,List<? extends Expression> args){
  if (args != null && !args.isEmpty()) {
    for (    Expression arg : args) {
      if (arg == expr) {
        return true;
      }
      if (arg instanceof NamedArgumentListExpression) {
        return isArgument(expr,((NamedArgumentListExpression)arg).getMapEntryExpressions());
      }
    }
  }
  return false;
}
Program: 185606
Project: 185606
Buggy source:
/** 
 * Basic initialization of the node - try and do most resolution lazily but some elements are worth getting correct up front: superclass, superinterfaces
 */
void initialize(){
  if (beingInitialized) {
    return;
  }
  try {
    beingInitialized=true;
    if (!jdtBinding.isInterface()) {
      ReferenceBinding superClass=jdtBinding.superclass();
      if (superClass != null) {
        setUnresolvedSuperClass(resolver.convertToClassNode(superClass));
      }
    }
    ReferenceBinding[] superInterfaceBindings=jdtBinding.superInterfaces();
    superInterfaceBindings=superInterfaceBindings == null ? Binding.NO_SUPERINTERFACES : superInterfaceBindings;
    ClassNode[] interfaces=new ClassNode[superInterfaceBindings.length];
    for (int i=0; i < superInterfaceBindings.length; i++) {
      interfaces[i]=resolver.convertToClassNode(superInterfaceBindings[i]);
    }
    setInterfaces(interfaces);
    initializeMembers();
  }
  finally {
    beingInitialized=false;
  }
}

Fixed version (ground truth):
/** 
 * Basic initialization of the node - try and do most resolution lazily but some elements are worth getting correct up front: superclass, superinterfaces
 */
void initialize(){
  if (beingInitialized) {
    return;
  }
  try {
    beingInitialized=true;
    if (!jdtBinding.isInterface()) {
      ReferenceBinding superClass=jdtBinding.superclass();
      if (superClass != null) {
        setUnresolvedSuperClass(resolver.convertToClassNode(superClass));
      }
    }
    ReferenceBinding[] superInterfaceBindings=jdtBinding.superInterfaces();
    if (superInterfaceBindings == null)     superInterfaceBindings=Binding.NO_SUPERINTERFACES;
    int n=superInterfaceBindings.length;
    ClassNode[] interfaces=new ClassNode[n];
    for (int i=0; i < n; i+=1) {
      interfaces[i]=resolver.convertToClassNode(superInterfaceBindings[i]);
    }
    setInterfaces(interfaces);
    initializeMembers();
  }
  finally {
    beingInitialized=false;
  }
}
Program: 185608
Project: 185608
Buggy source:
protected String wrapHTML(JavadocBrowserInformationControlInput input,IGroovyResolvedElement elt){
  String preamble;
  if (!elt.getElementName().equals(elt.getInferredElementName())) {
    preamble=createLabel(elt.getInferredElement());
  }
 else {
    preamble="String_Node_Str";
  }
  if (elt.getExtraDoc() != null) {
    String wrapped=preamble + extraDocAsHtml(elt) + "String_Node_Str"+ input.getHtml();
    return wrapped;
  }
 else {
    return preamble + input.getHtml();
  }
}

Fixed version (ground truth):
protected String wrapHTML(JavadocBrowserInformationControlInput input,IGroovyResolvedElement elt){
  String preamble;
  if (!elt.getElementName().equals(elt.getInferredElementName())) {
    preamble=createLabel(elt.getInferredElement());
  }
 else {
    preamble="String_Node_Str";
  }
  if (elt.getExtraDoc() != null) {
    return preamble + extraDocAsHtml(elt) + "String_Node_Str"+ input.getHtml();
  }
 else {
    return preamble + input.getHtml();
  }
}
Program: 185609
Project: 185609
Buggy source:
protected String extraDocAsHtml(IGroovyResolvedElement elt){
  String extraDoc="String_Node_Str" + elt.getExtraDoc() + "String_Node_Str";
  if (!extraDoc.startsWith("String_Node_Str")) {
    extraDoc="String_Node_Str" + extraDoc;
  }
  if (!extraDoc.endsWith("String_Node_Str")) {
    extraDoc=extraDoc + "String_Node_Str";
  }
  return (String)ReflectionUtils.executePrivateMethod(JavadocContentAccess2.class,"String_Node_Str",new Class[]{IMember.class,String.class},null,new Object[]{elt,extraDoc});
}

Fixed version (ground truth):
protected String extraDocAsHtml(IGroovyResolvedElement elem){
  String extraDoc=elem.getExtraDoc();
  if (!extraDoc.startsWith("String_Node_Str")) {
    extraDoc="String_Node_Str" + extraDoc;
  }
  if (!extraDoc.endsWith("String_Node_Str")) {
    extraDoc=extraDoc + "String_Node_Str";
  }
  String html;
  try {
    html=(String)ReflectionUtils.throwableExecutePrivateMethod(JavadocContentAccess2.class,"String_Node_Str",new Class[]{IMember.class,IJavaElement.class,String.class},null,new Object[]{elem,elem,extraDoc});
  }
 catch (  Exception e) {
    html=(String)ReflectionUtils.executePrivateMethod(JavadocContentAccess2.class,"String_Node_Str",new Class[]{IMember.class,String.class},null,new Object[]{elem,extraDoc});
  }
  return html;
}
Program: 185610
Project: 185610
Buggy source:
private String createClassLabel(ClassNode node){
  StringBuilder sb=new StringBuilder();
  node=node.redirect();
  if (ClassHelper.DYNAMIC_TYPE == node) {
    return "String_Node_Str";
  }
  sb.append(node.getNameWithoutPackage());
  GenericsType[] genericsTypes=node.getGenericsTypes();
  if (genericsTypes != null && genericsTypes.length > 0) {
    sb.append("String_Node_Str");
    for (int i=0; i < genericsTypes.length; i++) {
      sb.append(genericsTypes[i].getName());
      if (i < genericsTypes.length - 1) {
        sb.append("String_Node_Str");
      }
    }
    sb.append("String_Node_Str");
  }
  return sb.toString();
}

Fixed version (ground truth):
private String createClassLabel(ClassNode node){
  StringBuilder sb=new StringBuilder();
  node=node.redirect();
  if (ClassHelper.DYNAMIC_TYPE == node) {
    return "String_Node_Str";
  }
  sb.append(node.getNameWithoutPackage());
  GenericsType[] generics=node.getGenericsTypes();
  if (generics != null && generics.length > 0) {
    sb.append("String_Node_Str");
    for (int i=0, n=generics.length; i < n; i+=1) {
      sb.append(generics[i].getName());
      if (i < generics.length - 1) {
        sb.append("String_Node_Str");
      }
    }
    sb.append("String_Node_Str");
  }
  return sb.toString();
}