Program: 8457
Project: 8457
Buggy source:
@SuppressWarnings({"String_Node_Str"}) @RequestMapping(value="String_Node_Str",method=RequestMethod.GET,produces={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"}) @ResponseBody public ResponseEntity<Resource<?>> followPropertyReference(final RepositoryRestRequest repoRequest,@PathVariable String id,@PathVariable String property,final @PathVariable String propertyId) throws ResourceNotFoundException, NoSuchMethodException {
  final HttpHeaders headers=new HttpHeaders();
  Function<ReferencedProperty,Resource<?>> handler=new Function<ReferencedProperty,Resource<?>>(){
    @Override public Resource<?> apply(    ReferencedProperty prop){
      if (prop.property.isCollectionLike()) {
        PersistentEntity entity=repositories.getPersistentEntity(prop.propertyType);
        for (        Object obj : ((Iterable)prop.propertyValue)) {
          BeanWrapper propValWrapper=BeanWrapper.create(obj,conversionService);
          String sId=propValWrapper.getProperty(prop.entity.getIdProperty()).toString();
          if (propertyId.equals(sId)) {
            PersistentEntityResource per=PersistentEntityResource.wrap(entity,obj,repoRequest.getBaseUri());
            Link selfLink=entityLinks.linkForSingleResource(entity.getType(),sId).withSelfRel();
            per.add(selfLink);
            headers.set("String_Node_Str",selfLink.getHref());
            return per;
          }
        }
      }
 else       if (prop.property.isMap()) {
        PersistentEntity entity=repositories.getPersistentEntity(prop.propertyType);
        for (        Map.Entry<Object,Object> entry : ((Map<Object,Object>)prop.propertyValue).entrySet()) {
          BeanWrapper propValWrapper=BeanWrapper.create(entry.getValue(),conversionService);
          String sId=propValWrapper.getProperty(prop.entity.getIdProperty()).toString();
          if (propertyId.equals(sId)) {
            PersistentEntityResource per=PersistentEntityResource.wrap(entity,entry.getValue(),repoRequest.getBaseUri());
            Link selfLink=entityLinks.linkForSingleResource(entity.getType(),sId).withSelfRel();
            per.add(selfLink);
            headers.set("String_Node_Str",selfLink.getHref());
            return per;
          }
        }
      }
 else {
        return new Resource<Object>(prop.propertyValue);
      }
      throw new IllegalArgumentException(new ResourceNotFoundException());
    }
  }
;
  Resource<?> responseResource=doWithReferencedProperty(repoRequest,id,property,handler);
  return resourceResponse(headers,responseResource,HttpStatus.OK);
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str"}) @RequestMapping(value="String_Node_Str",method=RequestMethod.GET,produces={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"}) @ResponseBody public ResponseEntity<Resource<?>> followPropertyReference(final RepositoryRestRequest repoRequest,@PathVariable String id,@PathVariable String property,final @PathVariable String propertyId) throws ResourceNotFoundException, NoSuchMethodException {
  final HttpHeaders headers=new HttpHeaders();
  Function<ReferencedProperty,Resource<?>> handler=new Function<ReferencedProperty,Resource<?>>(){
    @Override public Resource<?> apply(    ReferencedProperty prop){
      if (null == prop.propertyValue) {
        throw new ResourceNotFoundException();
      }
      if (prop.property.isCollectionLike()) {
        PersistentEntity entity=repositories.getPersistentEntity(prop.propertyType);
        for (        Object obj : ((Iterable)prop.propertyValue)) {
          BeanWrapper propValWrapper=BeanWrapper.create(obj,conversionService);
          String sId=propValWrapper.getProperty(prop.entity.getIdProperty()).toString();
          if (propertyId.equals(sId)) {
            PersistentEntityResource per=PersistentEntityResource.wrap(entity,obj,repoRequest.getBaseUri());
            Link selfLink=entityLinks.linkForSingleResource(entity.getType(),sId).withSelfRel();
            per.add(selfLink);
            headers.set("String_Node_Str",selfLink.getHref());
            return per;
          }
        }
      }
 else       if (prop.property.isMap()) {
        PersistentEntity entity=repositories.getPersistentEntity(prop.propertyType);
        for (        Map.Entry<Object,Object> entry : ((Map<Object,Object>)prop.propertyValue).entrySet()) {
          BeanWrapper propValWrapper=BeanWrapper.create(entry.getValue(),conversionService);
          String sId=propValWrapper.getProperty(prop.entity.getIdProperty()).toString();
          if (propertyId.equals(sId)) {
            PersistentEntityResource per=PersistentEntityResource.wrap(entity,entry.getValue(),repoRequest.getBaseUri());
            Link selfLink=entityLinks.linkForSingleResource(entity.getType(),sId).withSelfRel();
            per.add(selfLink);
            headers.set("String_Node_Str",selfLink.getHref());
            return per;
          }
        }
      }
 else {
        return new Resource<Object>(prop.propertyValue);
      }
      throw new IllegalArgumentException(new ResourceNotFoundException());
    }
  }
;
  Resource<?> responseResource=doWithReferencedProperty(repoRequest,id,property,handler);
  return resourceResponse(headers,responseResource,HttpStatus.OK);
}