Program: 8471
Project: 8471
Buggy source:
/** 
 * Retrieve a linked entity from a parent entity.
 * @param request
 * @param baseUri
 * @param repository
 * @param id
 * @param property
 * @param linkedId
 * @return
 * @throws IOException
 */
@SuppressWarnings({"String_Node_Str"}) @RequestMapping(value="String_Node_Str",method={RequestMethod.GET}) @ResponseBody public ResponseEntity<?> linkedEntity(ServletServerHttpRequest request,URI baseUri,@PathVariable String repository,@PathVariable String id,@PathVariable String property,@PathVariable String linkedId) throws IOException {
  RepositoryMetadata repoMeta=repositoryMetadataFor(repository);
  if (!repoMeta.exportsMethod(CrudMethod.FIND_ONE)) {
    return negotiateResponse(request,HttpStatus.METHOD_NOT_ALLOWED,new HttpHeaders(),null);
  }
  CrudRepository repo=repoMeta.repository();
  Serializable serId=stringToSerializable(id,(Class<? extends Serializable>)repoMeta.entityMetadata().idAttribute().type());
  if (!repo.exists(serId)) {
    return notFoundResponse(request);
  }
  AttributeMetadata attrMeta;
  if (null == (attrMeta=repoMeta.entityMetadata().attribute(property))) {
    return notFoundResponse(request);
  }
  RepositoryMetadata linkedRepoMeta;
  if (null == (linkedRepoMeta=repositoryMetadataFor(attrMeta))) {
    return notFoundResponse(request);
  }
  if (!linkedRepoMeta.exportsMethod(CrudMethod.FIND_ONE)) {
    return negotiateResponse(request,HttpStatus.METHOD_NOT_ALLOWED,new HttpHeaders(),null);
  }
  CrudRepository linkedRepo=linkedRepoMeta.repository();
  Serializable sChildId=stringToSerializable(linkedId,(Class<? extends Serializable>)linkedRepoMeta.entityMetadata().idAttribute().type());
  Object linkedEntity;
  if (null == (linkedEntity=linkedRepo.findOne(sChildId))) {
    return notFoundResponse(request);
  }
  String propertyRel=repository + "String_Node_Str" + repoMeta.entityMetadata().type().getSimpleName()+ "String_Node_Str"+ property;
  URI propertyPath=buildUri(baseUri,repository,id,property,linkedId);
  URI selfUri=buildUri(baseUri,linkedRepoMeta.name(),linkedId);
  Resource<?> r;
  if (conversionService.canConvert(linkedEntity.getClass(),Resource.class)) {
    r=conversionService.convert(linkedEntity,Resource.class);
  }
 else {
    r=new Resource<Object>(linkedEntity);
  }
  r.add(new Link(propertyPath.toString(),propertyRel));
  HttpHeaders headers=new HttpHeaders();
  headers.add("String_Node_Str",selfUri.toString());
  return negotiateResponse(request,HttpStatus.OK,headers,r);
}

Fixed version (ground truth):
/** 
 * Retrieve a linked entity from a parent entity.
 * @param request
 * @param baseUri
 * @param repository
 * @param id
 * @param property
 * @param linkedId
 * @return
 * @throws IOException
 */
@SuppressWarnings({"String_Node_Str"}) @RequestMapping(value="String_Node_Str",method={RequestMethod.GET}) @ResponseBody public ResponseEntity<?> linkedEntity(ServletServerHttpRequest request,URI baseUri,@PathVariable String repository,@PathVariable String id,@PathVariable String property,@PathVariable String linkedId) throws IOException {
  RepositoryMetadata repoMeta=repositoryMetadataFor(repository);
  if (!repoMeta.exportsMethod(CrudMethod.FIND_ONE)) {
    return negotiateResponse(request,HttpStatus.METHOD_NOT_ALLOWED,new HttpHeaders(),null);
  }
  CrudRepository repo=repoMeta.repository();
  Serializable serId=stringToSerializable(id,(Class<? extends Serializable>)repoMeta.entityMetadata().idAttribute().type());
  if (!repo.exists(serId)) {
    return notFoundResponse(request);
  }
  AttributeMetadata attrMeta;
  if (null == (attrMeta=repoMeta.entityMetadata().attribute(property))) {
    return notFoundResponse(request);
  }
  RepositoryMetadata linkedRepoMeta;
  if (null == (linkedRepoMeta=repositoryMetadataFor(attrMeta))) {
    return notFoundResponse(request);
  }
  if (!linkedRepoMeta.exportsMethod(CrudMethod.FIND_ONE)) {
    return negotiateResponse(request,HttpStatus.METHOD_NOT_ALLOWED,new HttpHeaders(),null);
  }
  CrudRepository linkedRepo=linkedRepoMeta.repository();
  Serializable sChildId=stringToSerializable(linkedId,(Class<? extends Serializable>)linkedRepoMeta.entityMetadata().idAttribute().type());
  Object linkedEntity;
  if (null == (linkedEntity=linkedRepo.findOne(sChildId))) {
    return notFoundResponse(request);
  }
  String propertyRel=repoMeta.rel() + "String_Node_Str" + repoMeta.entityMetadata().type().getSimpleName()+ "String_Node_Str"+ property;
  URI propertyPath=buildUri(baseUri,repository,id,property,linkedId);
  URI selfUri=buildUri(baseUri,linkedRepoMeta.name(),linkedId);
  Resource<?> r;
  if (conversionService.canConvert(linkedEntity.getClass(),Resource.class)) {
    r=conversionService.convert(linkedEntity,Resource.class);
  }
 else {
    r=new Resource<Object>(linkedEntity);
  }
  r.add(new Link(propertyPath.toString(),propertyRel));
  HttpHeaders headers=new HttpHeaders();
  headers.add("String_Node_Str",selfUri.toString());
  return negotiateResponse(request,HttpStatus.OK,headers,r);
}