Program: 102442
Project: 102442
Buggy source:
/** 
 * {@inheritDoc}
 */
@GET @Path("String_Node_Str") @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 getSpaceMembers(@Context UriInfo uriInfo,@ApiParam(value="String_Node_Str",required=true) @PathParam("String_Node_Str") String id,@ApiParam(value="String_Node_Str",required=false,defaultValue="String_Node_Str") @QueryParam("String_Node_Str") String role,@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 {
  String authenticatedUser=ConversationState.getCurrent().getIdentity().getUserId();
  SpaceService spaceService=CommonsUtils.getService(SpaceService.class);
  Space space=spaceService.getSpaceById(id);
  if (space == null || (!spaceService.isMember(space,authenticatedUser) && !RestUtils.isMemberOfAdminGroup())) {
    throw new WebApplicationException(Response.Status.UNAUTHORIZED);
  }
  String[] users=(role != null && role.equals("String_Node_Str")) ? space.getManagers() : space.getMembers();
  int size=users.length;
  users=Arrays.copyOfRange(users,offset > size - 1 ? size - 1 : offset,(offset + limit > size) ? size : (offset + limit));
  List<DataEntity> profileInfos=EntityBuilder.buildEntityProfiles(users,uriInfo.getPath(),expand);
  CollectionEntity collectionUser=new CollectionEntity(profileInfos,EntityBuilder.USERS_TYPE,offset,limit);
  if (returnSize) {
    collectionUser.setSize(size);
  }
  return EntityBuilder.getResponse(collectionUser,uriInfo,RestUtils.getJsonMediaType(),Response.Status.OK);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@GET @Path("String_Node_Str") @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 getSpaceMembers(@Context UriInfo uriInfo,@ApiParam(value="String_Node_Str",required=true) @PathParam("String_Node_Str") String id,@ApiParam(value="String_Node_Str",required=false,defaultValue="String_Node_Str") @QueryParam("String_Node_Str") String role,@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 {
  String authenticatedUser=ConversationState.getCurrent().getIdentity().getUserId();
  SpaceService spaceService=CommonsUtils.getService(SpaceService.class);
  Space space=spaceService.getSpaceById(id);
  if (space == null || (!spaceService.isMember(space,authenticatedUser) && !RestUtils.isMemberOfAdminGroup())) {
    throw new WebApplicationException(Response.Status.UNAUTHORIZED);
  }
  String[] users=(role != null && role.equals("String_Node_Str")) ? space.getManagers() : space.getMembers();
  int size=users.length;
  if (limit > 0) {
    users=Arrays.copyOfRange(users,offset > size - 1 ? size - 1 : offset,(offset + limit > size) ? size : (offset + limit));
  }
  List<DataEntity> profileInfos=EntityBuilder.buildEntityProfiles(users,uriInfo.getPath(),expand);
  CollectionEntity collectionUser=new CollectionEntity(profileInfos,EntityBuilder.USERS_TYPE,offset,limit);
  if (returnSize) {
    collectionUser.setSize(size);
  }
  return EntityBuilder.getResponse(collectionUser,uriInfo,RestUtils.getJsonMediaType(),Response.Status.OK);
}