Program: 51237
Project: 51237
Buggy source:
public void visitAbstractResource(AbstractResource resource){
  if ((resource.getResourceMethods().size() + resource.getSubResourceMethods().size() + resource.getSubResourceLocators().size()) == 0) {
    issueList.add(new ResourceModelIssue(resource,ImplMessages.ERROR_NO_SUB_RES_METHOD_LOCATOR_FOUND(resource.getResourceClass()),false));
  }
  if (resource.isRootResource() && ((null == resource.getPath()) || (null == resource.getPath().getValue()))) {
    issueList.add(new ResourceModelIssue(resource,ImplMessages.ERROR_RES_URI_PATH_INVALID(resource.getResourceClass(),resource.getPath()),true));
  }
  if (resource.isRootResource() && resource.getConstructors().isEmpty()) {
    issueList.add(new ResourceModelIssue(resource,ImplMessages.ROOT_RES_NO_PUBLIC_CTOR(resource.getResourceClass()),true));
  }
  Map<UriTemplate,String> srlUriTemplates=new HashMap<UriTemplate,String>();
  Map<UriTemplate,String> srlUriTemplatesWithSlash=new HashMap<UriTemplate,String>();
  for (  AbstractSubResourceLocator srl : resource.getSubResourceLocators()) {
    UriTemplate srlUriTemplate=new UriTemplate(srl.getPath().getValue());
    UriTemplate srlUriTemplateWithSlash=srlUriTemplate.endsWithSlash() ? srlUriTemplate : new UriTemplate(srl.getPath().getValue() + '/');
    if (srlUriTemplates.containsKey(srlUriTemplate)) {
      issueList.add(new ResourceModelIssue(resource,ImplMessages.AMBIGUOUS_SRLS(resource.getResourceClass(),srlUriTemplate.getTemplate(),srlUriTemplates.get(srlUriTemplate)),true));
    }
 else {
      if (srlUriTemplatesWithSlash.containsKey(srlUriTemplateWithSlash)) {
        issueList.add(new ResourceModelIssue(resource,ImplMessages.AMBIGUOUS_SRLS(resource.getResourceClass(),srlUriTemplate.getTemplate(),srlUriTemplatesWithSlash.get(srlUriTemplate)),true));
      }
 else {
        srlUriTemplatesWithSlash.put(srlUriTemplateWithSlash,srlUriTemplate.getTemplate());
      }
      srlUriTemplates.put(srlUriTemplate,srlUriTemplate.getTemplate());
    }
  }
  findOutMTAmbiguities(resource,resource.getResourceMethods(),new ResourceMethodAmbiguityErrMsgGenerator<AbstractResourceMethod>(){
    void generateInErrMsg(    AbstractResource resource,    AbstractResourceMethod arm1,    AbstractResourceMethod arm2,    MediaType mt){
      issueList.add(new ResourceModelIssue(resource,ImplMessages.AMBIGUOUS_RMS_IN(resource.getResourceClass(),arm1.getHttpMethod(),mt,arm1.getMethod().getName(),arm2.getMethod().getName(),arm1.getSupportedInputTypes(),arm2.getSupportedInputTypes()),false));
    }
    void generateOutErrMsg(    AbstractResource resource,    AbstractResourceMethod arm1,    AbstractResourceMethod arm2,    MediaType mt){
      issueList.add(new ResourceModelIssue(resource,ImplMessages.AMBIGUOUS_RMS_OUT(resource.getResourceClass(),arm1.getHttpMethod(),mt,arm1.getMethod().getName(),arm2.getMethod().getName(),arm1.getSupportedOutputTypes(),arm2.getSupportedOutputTypes()),true));
    }
  }
);
  findOutMTAmbiguities(resource,resource.getSubResourceMethods(),new ResourceMethodAmbiguityErrMsgGenerator<AbstractSubResourceMethod>(){
    boolean isConflictingPaths(    String path1,    String path2){
      UriTemplate t1=new UriTemplate(path1);
      UriTemplate t2=new UriTemplate(path2);
      if (t1.equals(t2)) {
        return true;
      }
 else {
        if (t1.endsWithSlash()) {
          return (!t2.endsWithSlash()) && t1.equals(new UriTemplate(path2 + "String_Node_Str"));
        }
 else {
          return t2.endsWithSlash() && t2.equals(new UriTemplate(path1 + "String_Node_Str"));
        }
      }
    }
    void generateInErrMsg(    AbstractResource resource,    AbstractSubResourceMethod arm1,    AbstractSubResourceMethod arm2,    MediaType mt){
      if (isConflictingPaths(arm1.getPath().getValue(),arm2.getPath().getValue())) {
        issueList.add(new ResourceModelIssue(resource,ImplMessages.AMBIGUOUS_SRMS_IN(resource.getResourceClass(),arm1.getHttpMethod(),arm1.getPath().getValue(),mt,arm1.getMethod().getName(),arm2.getMethod().getName(),arm1.getSupportedInputTypes(),arm2.getSupportedInputTypes()),false));
      }
    }
    void generateOutErrMsg(    AbstractResource resource,    AbstractSubResourceMethod arm1,    AbstractSubResourceMethod arm2,    MediaType mt){
      if (isConflictingPaths(arm1.getPath().getValue(),arm2.getPath().getValue())) {
        issueList.add(new ResourceModelIssue(resource,ImplMessages.AMBIGUOUS_SRMS_OUT(resource.getResourceClass(),arm1.getHttpMethod(),arm1.getPath().getValue(),mt,arm1.getMethod().getName(),arm2.getMethod().getName(),arm1.getSupportedOutputTypes(),arm2.getSupportedOutputTypes()),true));
      }
    }
  }
);
}

Fixed version (ground truth):
public void visitAbstractResource(AbstractResource resource){
  if ((resource.getResourceMethods().size() + resource.getSubResourceMethods().size() + resource.getSubResourceLocators().size()) == 0) {
    issueList.add(new ResourceModelIssue(resource,ImplMessages.ERROR_NO_SUB_RES_METHOD_LOCATOR_FOUND(resource.getResourceClass()),false));
  }
  if (resource.isRootResource() && ((null == resource.getPath()) || (null == resource.getPath().getValue()))) {
    issueList.add(new ResourceModelIssue(resource,ImplMessages.ERROR_RES_URI_PATH_INVALID(resource.getResourceClass(),resource.getPath()),true));
  }
  if (resource.isRootResource() && resource.getConstructors().isEmpty()) {
    issueList.add(new ResourceModelIssue(resource,ImplMessages.ROOT_RES_NO_PUBLIC_CTOR(resource.getResourceClass()),true));
  }
  Map<UriTemplate,String> srlUriTemplates=new HashMap<UriTemplate,String>();
  Map<UriTemplate,String> srlUriTemplatesWithSlash=new HashMap<UriTemplate,String>();
  for (  AbstractSubResourceLocator srl : resource.getSubResourceLocators()) {
    UriTemplate srlUriTemplate=new UriTemplate(srl.getPath().getValue());
    UriTemplate srlUriTemplateWithSlash=srlUriTemplate.endsWithSlash() ? srlUriTemplate : new UriTemplate(srl.getPath().getValue() + '/');
    if (srlUriTemplates.containsKey(srlUriTemplate)) {
      issueList.add(new ResourceModelIssue(resource,ImplMessages.AMBIGUOUS_SRLS(resource.getResourceClass(),srlUriTemplate.getTemplate(),srlUriTemplates.get(srlUriTemplate)),true));
    }
 else {
      if (srlUriTemplatesWithSlash.containsKey(srlUriTemplateWithSlash)) {
        issueList.add(new ResourceModelIssue(resource,ImplMessages.AMBIGUOUS_SRLS(resource.getResourceClass(),srlUriTemplate.getTemplate(),srlUriTemplatesWithSlash.get(srlUriTemplate)),true));
      }
 else {
        srlUriTemplatesWithSlash.put(srlUriTemplateWithSlash,srlUriTemplate.getTemplate());
      }
      srlUriTemplates.put(srlUriTemplate,srlUriTemplate.getTemplate());
    }
  }
  findOutMTAmbiguities(resource,resource.getResourceMethods(),new ResourceMethodAmbiguityErrMsgGenerator<AbstractResourceMethod>(){
    void generateInErrMsg(    AbstractResource resource,    AbstractResourceMethod arm1,    AbstractResourceMethod arm2,    MediaType mt){
      issueList.add(new ResourceModelIssue(resource,ImplMessages.AMBIGUOUS_RMS_IN(resource.getResourceClass(),arm1.getHttpMethod(),mt,arm1.getMethod().getName(),arm2.getMethod().getName(),arm1.getSupportedInputTypes(),arm2.getSupportedInputTypes()),false));
    }
    void generateOutErrMsg(    AbstractResource resource,    AbstractResourceMethod arm1,    AbstractResourceMethod arm2,    MediaType mt){
      issueList.add(new ResourceModelIssue(resource,ImplMessages.AMBIGUOUS_RMS_OUT(resource.getResourceClass(),arm1.getHttpMethod(),mt,arm1.getMethod().getName(),arm2.getMethod().getName(),arm1.getSupportedOutputTypes(),arm2.getSupportedOutputTypes()),true));
    }
  }
);
  findOutMTAmbiguities(resource,resource.getSubResourceMethods(),new ResourceMethodAmbiguityErrMsgGenerator<AbstractSubResourceMethod>(){
    boolean isConflictingPaths(    String path1,    String path2){
      UriTemplate t1=new UriTemplate(path1);
      UriTemplate t2=new UriTemplate(path2);
      if (t1.equals(t2)) {
        return true;
      }
 else {
        if (t1.endsWithSlash()) {
          return (!t2.endsWithSlash()) && t1.equals(new UriTemplate(path2 + "String_Node_Str"));
        }
 else {
          return t2.endsWithSlash() && t2.equals(new UriTemplate(path1 + "String_Node_Str"));
        }
      }
    }
    void generateInErrMsg(    AbstractResource resource,    AbstractSubResourceMethod arm1,    AbstractSubResourceMethod arm2,    MediaType mt){
      if (isConflictingPaths(arm1.getPath().getValue(),arm2.getPath().getValue())) {
        issueList.add(new ResourceModelIssue(resource,ImplMessages.AMBIGUOUS_SRMS_IN(resource.getResourceClass(),arm1.getHttpMethod(),arm1.getPath().getValue(),mt,arm1.getMethod().getName(),arm2.getMethod().getName(),arm1.getSupportedInputTypes(),arm2.getSupportedInputTypes()),false));
      }
    }
    void generateOutErrMsg(    AbstractResource resource,    AbstractSubResourceMethod arm1,    AbstractSubResourceMethod arm2,    MediaType mt){
      if (isConflictingPaths(arm1.getPath().getValue(),arm2.getPath().getValue())) {
        issueList.add(new ResourceModelIssue(resource,ImplMessages.AMBIGUOUS_SRMS_OUT(resource.getResourceClass(),arm1.getHttpMethod(),arm1.getPath().getValue(),mt,arm1.getMethod().getName(),arm2.getMethod().getName(),arm1.getSupportedOutputTypes(),arm2.getSupportedOutputTypes()),true));
      }
    }
  }
);
  for (  AbstractSetterMethod asm : resource.getSetterMethods()) {
    checkParameter(asm,asm.getMethod().toString(),"String_Node_Str",asm.getMethod().getDeclaredAnnotations());
  }
  for (  AbstractField af : resource.getFields()) {
    checkParameter(af,af.getField().toString(),af.getField().getName(),af.getField().getDeclaredAnnotations());
  }
  checkNonPublicMethods(resource);
}