Program: 8464
Project: 8464
Buggy source:
@SuppressWarnings({"String_Node_Str"}) @RequestMapping(method=RequestMethod.GET,produces={"String_Node_Str","String_Node_Str"}) @ResponseBody public Resources<Resource<?>> listEntities(RepositoryRestRequest repoRequest) throws ResourceNotFoundException {
  List<Resource<?>> resources=new ArrayList<Resource<?>>();
  List<Link> links=new ArrayList<Link>();
  Iterable<?> results;
  RepositoryMethodInvoker repoMethodInvoker=repoRequest.getRepositoryMethodInvoker();
  if (null == repoMethodInvoker) {
    throw new ResourceNotFoundException();
  }
  boolean hasPagingParams=(null != repoRequest.getRequest().getParameter(config.getPageParamName()));
  boolean hasSortParams=(null != repoRequest.getRequest().getParameter(config.getSortParamName()));
  if (repoMethodInvoker.hasFindAllPageable() && hasPagingParams) {
    results=repoMethodInvoker.findAll(new PageRequest(repoRequest.getPagingAndSorting().getPageNumber(),repoRequest.getPagingAndSorting().getPageSize(),repoRequest.getPagingAndSorting().getSort()));
  }
 else   if (repoMethodInvoker.hasFindAllSorted() && hasSortParams) {
    results=repoMethodInvoker.findAll(repoRequest.getPagingAndSorting().getSort());
  }
 else   if (repoMethodInvoker.hasFindAll()) {
    results=repoMethodInvoker.findAll();
  }
 else {
    throw new ResourceNotFoundException();
  }
  for (  Object o : results) {
    BeanWrapper wrapper=BeanWrapper.create(o,conversionService);
    Link selfLink=entityLinks.linkForSingleResource(repoRequest.getPersistentEntity().getType(),wrapper.getProperty(repoRequest.getPersistentEntity().getIdProperty())).withSelfRel();
    resources.add(new PersistentEntityResource<Object>(repoRequest.getPersistentEntity(),o,selfLink).setBaseUri(repoRequest.getBaseUri()));
  }
  if (!repoMethodInvoker.getQueryMethods().isEmpty()) {
    ResourceMapping repoMapping=repoRequest.getRepositoryResourceMapping();
    links.add(new Link(buildUri(repoRequest.getBaseUri(),repoMapping.getPath(),"String_Node_Str").toString(),repoMapping.getRel() + "String_Node_Str"));
  }
  return new Resources<Resource<?>>(resources,links);
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str"}) @RequestMapping(method=RequestMethod.GET,produces={"String_Node_Str","String_Node_Str"}) @ResponseBody public Resources<Resource<?>> listEntities(final RepositoryRestRequest repoRequest) throws ResourceNotFoundException {
  List<Resource<?>> resources=new ArrayList<Resource<?>>();
  List<Link> links=new ArrayList<Link>();
  Iterable<?> results;
  RepositoryMethodInvoker repoMethodInvoker=repoRequest.getRepositoryMethodInvoker();
  if (null == repoMethodInvoker) {
    throw new ResourceNotFoundException();
  }
  boolean hasPagingParams=(null != repoRequest.getRequest().getParameter(config.getPageParamName()));
  boolean hasSortParams=(null != repoRequest.getRequest().getParameter(config.getSortParamName()));
  if (repoMethodInvoker.hasFindAllPageable() && hasPagingParams) {
    results=repoMethodInvoker.findAll(new PageRequest(repoRequest.getPagingAndSorting().getPageNumber(),repoRequest.getPagingAndSorting().getPageSize(),repoRequest.getPagingAndSorting().getSort()));
  }
 else   if (repoMethodInvoker.hasFindAllSorted() && hasSortParams) {
    results=repoMethodInvoker.findAll(repoRequest.getPagingAndSorting().getSort());
  }
 else   if (repoMethodInvoker.hasFindAll()) {
    results=repoMethodInvoker.findAll();
  }
 else {
    throw new ResourceNotFoundException();
  }
  for (  Object o : results) {
    BeanWrapper wrapper=BeanWrapper.create(o,conversionService);
    Link selfLink=entityLinks.linkForSingleResource(repoRequest.getPersistentEntity().getType(),wrapper.getProperty(repoRequest.getPersistentEntity().getIdProperty())).withSelfRel();
    resources.add(new PersistentEntityResource<Object>(repoRequest.getPersistentEntity(),o,selfLink).setBaseUri(repoRequest.getBaseUri()));
  }
  if (!repoMethodInvoker.getQueryMethods().isEmpty()) {
    ResourceMapping repoMapping=repoRequest.getRepositoryResourceMapping();
    links.add(new Link(buildUri(repoRequest.getBaseUri(),repoMapping.getPath(),"String_Node_Str").toString(),repoMapping.getRel() + "String_Node_Str"));
  }
  if (hasPagingParams || hasSortParams) {
    PageRequest pr=new PageRequest(repoRequest.getPagingAndSorting().getPageNumber() + 1,repoRequest.getPagingAndSorting().getPageSize(),repoRequest.getPagingAndSorting().getSort()){
      @Override public int getOffset(){
        return super.getOffset() - repoRequest.getPagingAndSorting().getPageSize();
      }
    }
;
    return new PageableResources<Resource<?>>(resources,pr,links);
  }
 else {
    return new Resources<Resource<?>>(resources,links);
  }
}