Program: 102446
Project: 102446
Buggy source:
@POST @Produces(MediaType.APPLICATION_JSON) @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=400,message="String_Node_Str")}) public Response addUser(@Context UriInfo uriInfo,@ApiParam(value="String_Node_Str",required=false) @QueryParam("String_Node_Str") String expand,@ApiParam(value="String_Node_Str",required=true) UserEntity model) throws Exception {
  if (model.isNotValid()) {
    throw new WebApplicationException(Response.Status.UNAUTHORIZED);
  }
  if (!RestUtils.isMemberOfAdminGroup()) {
    throw new WebApplicationException(Response.Status.FORBIDDEN);
  }
  Identity identity=CommonsUtils.getService(IdentityManager.class).getOrCreateIdentity(OrganizationIdentityProvider.NAME,model.getUsername(),true);
  if (identity != null) {
    throw new WebApplicationException(Response.Status.BAD_REQUEST);
  }
  UserHandler userHandler=CommonsUtils.getService(OrganizationService.class).getUserHandler();
  User user=userHandler.createUserInstance(model.getUsername());
  user.setFirstName(model.getFirstname());
  user.setLastName(model.getLastname());
  user.setEmail(model.getEmail());
  user.setPassword(model.getPassword() == null || model.getPassword().isEmpty() ? "String_Node_Str" : model.getPassword());
  userHandler.createUser(user,true);
  return EntityBuilder.getResponse(EntityBuilder.buildEntityProfile(model.getUsername(),uriInfo.getPath(),expand),uriInfo,RestUtils.getJsonMediaType(),Response.Status.OK);
}

Fixed version (ground truth):
@POST @Produces(MediaType.APPLICATION_JSON) @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=400,message="String_Node_Str")}) public Response addUser(@Context UriInfo uriInfo,@ApiParam(value="String_Node_Str",required=false) @QueryParam("String_Node_Str") String expand,@ApiParam(value="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",required=true) UserEntity model) throws Exception {
  if (model.isNotValid()) {
    throw new WebApplicationException(Response.Status.UNAUTHORIZED);
  }
  if (!RestUtils.isMemberOfAdminGroup()) {
    throw new WebApplicationException(Response.Status.FORBIDDEN);
  }
  Identity identity=CommonsUtils.getService(IdentityManager.class).getOrCreateIdentity(OrganizationIdentityProvider.NAME,model.getUsername(),true);
  if (identity != null) {
    throw new WebApplicationException(Response.Status.BAD_REQUEST);
  }
  UserHandler userHandler=CommonsUtils.getService(OrganizationService.class).getUserHandler();
  User user=userHandler.createUserInstance(model.getUsername());
  user.setFirstName(model.getFirstname());
  user.setLastName(model.getLastname());
  user.setEmail(model.getEmail());
  user.setPassword(model.getPassword() == null || model.getPassword().isEmpty() ? "String_Node_Str" : model.getPassword());
  userHandler.createUser(user,true);
  return EntityBuilder.getResponse(EntityBuilder.buildEntityProfile(model.getUsername(),uriInfo.getPath(),expand),uriInfo,RestUtils.getJsonMediaType(),Response.Status.OK);
}