Program: 102440
Project: 102440
Buggy source:
/** 
 * {@inheritDoc}
 */
@GET @RolesAllowed("String_Node_Str") @ApiOperation(value="String_Node_Str",httpMethod="String_Node_Str",response=Response.class,notes="String_Node_Str") @ApiResponses(value={@ApiResponse(code=200,message="String_Node_Str"),@ApiResponse(code=500,message="String_Node_Str"),@ApiResponse(code=400,message="String_Node_Str")}) public Response getIdentities(@Context UriInfo uriInfo,@ApiParam(value="String_Node_Str",required=false) @QueryParam("String_Node_Str") String type,@ApiParam(value="String_Node_Str",required=false,defaultValue="String_Node_Str") @QueryParam("String_Node_Str") int offset,@ApiParam(value="String_Node_Str",required=false,defaultValue="String_Node_Str") @QueryParam("String_Node_Str") int limit,@ApiParam(value="String_Node_Str",defaultValue="String_Node_Str") @QueryParam("String_Node_Str") boolean returnSize,@ApiParam(value="String_Node_Str",required=false) @QueryParam("String_Node_Str") String expand) throws Exception {
  IdentityManager identityManager=CommonsUtils.getService(IdentityManager.class);
  String providerId=(type != null && type.equals("String_Node_Str")) ? SpaceIdentityProvider.NAME : OrganizationIdentityProvider.NAME;
  ListAccess<Identity> listAccess=identityManager.getIdentitiesByProfileFilter(providerId,new ProfileFilter(),true);
  Identity[] identities=listAccess.load(offset,limit);
  List<DataEntity> identityEntities=new ArrayList<DataEntity>();
  for (  Identity identity : identities) {
    identityEntities.add(EntityBuilder.buildEntityIdentity(identity,uriInfo.getPath(),expand).getDataEntity());
  }
  CollectionEntity collectionIdentity=new CollectionEntity(identityEntities,EntityBuilder.IDENTITIES_TYPE,offset,limit);
  if (returnSize) {
    collectionIdentity.setSize(listAccess.getSize());
  }
  return EntityBuilder.getResponse(collectionIdentity,uriInfo,RestUtils.getJsonMediaType(),Response.Status.OK);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@GET @RolesAllowed("String_Node_Str") @ApiOperation(value="String_Node_Str",httpMethod="String_Node_Str",response=Response.class,notes="String_Node_Str") @ApiResponses(value={@ApiResponse(code=200,message="String_Node_Str"),@ApiResponse(code=500,message="String_Node_Str"),@ApiResponse(code=400,message="String_Node_Str")}) public Response getIdentities(@Context UriInfo uriInfo,@ApiParam(value="String_Node_Str",required=false,defaultValue="String_Node_Str") @QueryParam("String_Node_Str") String type,@ApiParam(value="String_Node_Str",required=false,defaultValue="String_Node_Str") @QueryParam("String_Node_Str") int offset,@ApiParam(value="String_Node_Str",required=false,defaultValue="String_Node_Str") @QueryParam("String_Node_Str") int limit,@ApiParam(value="String_Node_Str",defaultValue="String_Node_Str") @QueryParam("String_Node_Str") boolean returnSize,@ApiParam(value="String_Node_Str",required=false) @QueryParam("String_Node_Str") String expand) throws Exception {
  IdentityManager identityManager=CommonsUtils.getService(IdentityManager.class);
  String providerId=(type != null && type.equals("String_Node_Str")) ? SpaceIdentityProvider.NAME : OrganizationIdentityProvider.NAME;
  ListAccess<Identity> listAccess=identityManager.getIdentitiesByProfileFilter(providerId,new ProfileFilter(),true);
  Identity[] identities=listAccess.load(offset,limit);
  List<DataEntity> identityEntities=new ArrayList<DataEntity>();
  for (  Identity identity : identities) {
    identityEntities.add(EntityBuilder.buildEntityIdentity(identity,uriInfo.getPath(),expand).getDataEntity());
  }
  CollectionEntity collectionIdentity=new CollectionEntity(identityEntities,EntityBuilder.IDENTITIES_TYPE,offset,limit);
  if (returnSize) {
    collectionIdentity.setSize(listAccess.getSize());
  }
  return EntityBuilder.getResponse(collectionIdentity,uriInfo,RestUtils.getJsonMediaType(),Response.Status.OK);
}