{"record":{"id":"c1d1983005dec8af","repo":"paascloud/paascloud-master","slug":"error-c1d198","errorCode":null,"errorMessage":"参数不能为空","messagePattern":"参数不能为空","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacRoleServiceImpl.java","lineNumber":192,"sourceCode":"\t\tList<UacRoleUser> setAlreadyBindUserSet = uacRoleUserService.listByRoleId(roleId);\n\t\tSet<BindUserDto> allUserSet = new HashSet<>(bindUserDtoList);\n\n\t\tfor (UacRoleUser uacRoleUser : setAlreadyBindUserSet) {\n\t\t\talreadyBindUserIdSet.add(uacRoleUser.getUserId());\n\t\t}\n\n\t\troleBindUserDto.setAllUserSet(allUserSet);\n\t\troleBindUserDto.setAlreadyBindUserIdSet(alreadyBindUserIdSet);\n\n\t\treturn roleBindUserDto;\n\t}\n\n\t@Override\n\tpublic void bindUser4Role(RoleBindUserReqDto roleBindUserReqDto, LoginAuthDto authResDto) {\n\n\t\tif (roleBindUserReqDto == null) {\n\t\t\tlogger.error(\"参数不能为空\");\n\t\t\tthrow new IllegalArgumentException(\"参数不能为空\");\n\t\t}\n\n\t\tLong roleId = roleBindUserReqDto.getRoleId();\n\t\tLong loginUserId = authResDto.getUserId();\n\t\tList<Long> userIdList = roleBindUserReqDto.getUserIdList();\n\n\t\tif (null == roleId) {\n\t\t\tthrow new IllegalArgumentException(ErrorCodeEnum.UAC10012001.msg());\n\t\t}\n\n\t\tUacRole role = this.getRoleById(roleId);\n\n\t\tif (role == null) {\n\t\t\tlogger.error(\"找不到角色信息 roleId={}\", roleId);\n\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10012005, roleId);\n\t\t}\n\n\t\tif (PublicUtil.isNotEmpty(userIdList) && userIdList.contains(loginUserId)) {","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/paascloud/paascloud-master/blob/781281a9503332ed3cef44ea618349d14230a127/paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacRoleServiceImpl.java#L174-L210","documentation":"bindUser4Role throws this IllegalArgumentException when the RoleBindUserReqDto argument itself is null. The service logs '参数不能为空' (parameter cannot be empty) before throwing. It is a guard against being called with no request object at all.","triggerScenarios":"Calling uacRoleService.bindUser4Role(null, authResDto), typically when an upstream controller passes an unbound/deserialization-failed request body.","commonSituations":"Feign/gateway calls with empty POST bodies, missing @RequestBody in the controller, or a caller constructing the DTO conditionally and forgetting to set it.","solutions":["Ensure the caller constructs and passes a non-null RoleBindUserReqDto","In the REST controller, annotate the body parameter with @RequestBody and validate it (@Valid/@NotNull) before invoking the service","Catch IllegalArgumentException at the API boundary and return a 400-style response instead of a 500"],"exampleFix":"// before\nuacRoleService.bindUser4Role(reqDto, loginAuthDto);\n// after\nif (reqDto == null) { throw new BusinessException(\"角色绑定请求不能为空\"); }\nuacRoleService.bindUser4Role(reqDto, loginAuthDto);","handlingStrategy":"validation","validationCode":"if (reqDto == null) { throw new IllegalArgumentException(\"bindUser4Role request cannot be null\"); }","typeGuard":"boolean isValid = dto != null;","tryCatchPattern":"try { service.bindUser4Role(dto, auth); } catch (IllegalArgumentException e) { return Response.badRequest(e.getMessage()); }","preventionTips":["Use @NotNull/@Valid on controller DTOs so nulls never reach the service","Never pass raw, possibly-unbound request objects into services"],"tags":["null-argument","java","role-binding"],"backgroundTag":"null-argument","analyzedSha":"781281a9503332ed3cef44ea618349d14230a127","analyzedAt":"2026-09-10T10:59:02.070Z","contentChangedAt":"2026-09-10T10:59:02.070Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}