{"record":{"id":"89b4b9dbfbe64545","repo":"paascloud/paascloud-master","slug":"error-89b4b9","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/UacUserServiceImpl.java","lineNumber":282,"sourceCode":"\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10011023);\n\t\t}\n\t\tUacUser u = uacUserMapper.selectByPrimaryKey(userId);\n\t\tif (u == null) {\n\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10011011, userId);\n\t\t}\n\n\t\t// 更新用户最后修改人与修改时间\n\t\tuacUser.setVersion(u.getVersion() + 1);\n\t\tuacUser.setUpdateInfo(authResDto);\n\t\treturn uacUserMapper.updateByPrimaryKeySelective(uacUser);\n\t}\n\n\t@Override\n\tpublic void bindUserRoles(BindUserRolesDto bindUserRolesDto, LoginAuthDto authResDto) {\n\n\t\tif (bindUserRolesDto == null) {\n\t\t\tlogger.error(\"参数不能为空\");\n\t\t\tthrow new IllegalArgumentException(\"参数不能为空\");\n\t\t}\n\n\t\tLong operUserId = bindUserRolesDto.getUserId();\n\t\tLong loginUserId = authResDto.getUserId();\n\t\tList<Long> roleIdList = bindUserRolesDto.getRoleIdList();\n\n\t\tif (null == operUserId) {\n\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10011001);\n\t\t}\n\n\t\t// 任何用户不能操作admin用户\n\t\tif (Objects.equals(operUserId, GlobalConstant.Sys.SUPER_MANAGER_USER_ID)) {\n\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10011034);\n\t\t}\n\n\t\tUacUser user = this.queryByUserId(operUserId);\n\n\t\tif (user == null) {","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/paascloud/paascloud-master/blob/781281a9503332ed3cef44ea618349d14230a127/paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacUserServiceImpl.java#L264-L300","documentation":"In UacUserServiceImpl.bindUserRoles a null BindUserRolesDto causes logger.error(\"参数不能为空\") and an IllegalArgumentException with the same message. This is a plain JDK exception (not UacBizException) signaling a programming/caller error: the mandatory request body is entirely missing.","triggerScenarios":"Calling bindUserRoles(null, authResDto), or a controller binding that yields a null @RequestBody when the client sends no body or an empty payload.","commonSituations":"Client POSTs without a JSON body or with wrong Content-Type so Spring cannot bind the DTO; internal code paths invoking the service before constructing the DTO; unit tests passing null.","solutions":["Always construct and pass a populated BindUserRolesDto (userId + roleIdList) when calling the service","On the client, send a valid JSON body with Content-Type: application/json","Catch IllegalArgumentException around the call and return HTTP 400 'parameters cannot be empty'","Add @Valid/@NotNull bean validation on the controller parameter so Spring rejects null bodies earlier"],"exampleFix":"// before\nuacUserService.bindUserRoles(dto, authResDto); // dto may be null\n// after\nPreconditions.checkArgument(dto != null, \"参数不能为空\");\nuacUserService.bindUserRoles(dto, authResDto);","handlingStrategy":"validation","validationCode":"if (bindUserRolesDto == null) {\n    throw new IllegalArgumentException(\"参数不能为空\");\n}","typeGuard":"if (bindUserRolesDto != null\n        && bindUserRolesDto.getUserId() != null\n        && bindUserRolesDto.getRoleIdList() != null) {\n    uacUserService.bindUserRoles(bindUserRolesDto, authResDto);\n}","tryCatchPattern":"try {\n    uacUserService.bindUserRoles(dto, authResDto);\n} catch (IllegalArgumentException e) {\n    // return HTTP 400 'parameters cannot be empty'\n}","preventionTips":["Always send a valid JSON body with correct Content-Type","Use @RequestBody(required = true) / bean validation on controllers","Never call the service with an unconstructed DTO"],"tags":["null-argument","illegal-argument","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"}