{"record":{"id":"deff14aa189afc8b","repo":"paascloud/paascloud-master","slug":"uac10015002","errorCode":"UAC10015002","errorMessage":"UAC10015002","messagePattern":"UAC10015002","errorType":"error_code","errorClass":"UacBizException","httpStatus":null,"severity":"error","filePath":"paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacGroupServiceImpl.java","lineNumber":86,"sourceCode":"\t\treturn uacGroupMapper.updateByPrimaryKeySelective(group);\n\t}\n\n\t@Override\n\tpublic int updateUacGroupStatusById(IdStatusDto idStatusDto, LoginAuthDto loginAuthDto) {\n\n\t\tLong groupId = idStatusDto.getId();\n\t\tInteger status = idStatusDto.getStatus();\n\n\t\tUacGroup uacGroup = new UacGroup();\n\t\tuacGroup.setId(groupId);\n\t\tuacGroup.setStatus(status);\n\n\t\tUacGroup group = uacGroupMapper.selectByPrimaryKey(groupId);\n\t\tif (PublicUtil.isEmpty(group)) {\n\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10015001, groupId);\n\t\t}\n\t\tif (!UacGroupStatusEnum.contains(status)) {\n\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10015002);\n\t\t}\n\n\t\t//查询所有的组织\n\t\tList<UacGroup> totalGroupList = uacGroupMapper.selectAll();\n\t\tList<GroupZtreeVo> totalList = Lists.newArrayList();\n\t\tGroupZtreeVo zTreeVo;\n\t\tfor (UacGroup vo : totalGroupList) {\n\t\t\tzTreeVo = new GroupZtreeVo();\n\t\t\tzTreeVo.setId(vo.getId());\n\t\t\ttotalList.add(zTreeVo);\n\t\t}\n\n\t\tUacGroupUser uacGroupUser = new UacGroupUser();\n\t\tuacGroupUser.setUserId(loginAuthDto.getUserId());\n\t\tUacGroupUser groupUser = uacGroupUserMapper.selectOne(uacGroupUser);\n\t\t// 查询当前登陆人所在的组织信息\n\t\tUacGroup currentUserUacGroup = uacGroupMapper.selectByPrimaryKey(groupUser.getGroupId());\n\t\t// 查询当前登陆人能禁用的所有子节点","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/paascloud/paascloud-master/blob/781281a9503332ed3cef44ea618349d14230a127/paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacGroupServiceImpl.java#L68-L104","documentation":"UAC10015002 is thrown by updateUacGroupStatusById when the supplied status value is not one recognized by UacGroupStatusEnum.contains(status). It guards against writing an invalid lifecycle status to the group record.","triggerScenarios":"Calling updateUacGroupStatusById(groupId, status) with a status integer outside the UacGroupStatusEnum set (e.g. 2, -1, or a raw string-converted number instead of the defined ENABLE/DISABLE codes).","commonSituations":"Client sends status as a string like \"enabled\" and it is parsed incorrectly; enum values changed in a newer version while an old client still sends legacy codes; a REST caller guesses status codes instead of using the documented constants.","solutions":["Log the received status and compare it with UacGroupStatusEnum values; use only the defined constants (e.g. UacGroupStatusEnum.ENABLE.getStatus())","Fix the client/request mapping so status is serialized as the enum's integer code","Add request validation (a @Range or custom validator) on the status parameter before reaching the service"],"exampleFix":"// before\nint status = Integer.parseInt(request.getParameter(\"status\")); // \"enabled\" -> NumberFormatException or wrong code\nuacGroupService.updateUacGroupStatusById(groupId, status);\n// after\nUacGroupStatusEnum statusEnum = UacGroupStatusEnum.getByStatus(status);\nif (statusEnum == null || !UacGroupStatusEnum.contains(status)) {\n    throw new UacBizException(ErrorCodeEnum.UAC10015002);\n}\nuacGroupService.updateUacGroupStatusById(groupId, status);","handlingStrategy":"validation","validationCode":"if (!UacGroupStatusEnum.contains(status)) {\n    throw new UacBizException(ErrorCodeEnum.UAC10015002);\n}\nuacGroupService.updateUacGroupStatusById(groupId, status);","typeGuard":"UacGroupStatusEnum e = UacGroupStatusEnum.getByStatus(status);\nif (e == null) { throw new IllegalArgumentException(\"Unsupported status: \" + status); }","tryCatchPattern":"try {\n    uacGroupService.updateUacGroupStatusById(groupId, status);\n} catch (UacBizException e) {\n    if (ErrorCodeEnum.UAC10015002.getCode().equals(e.getCode())) { /* reject invalid status in request layer */ }\n    else throw e;\n}","preventionTips":["Use UacGroupStatusEnum constants instead of raw ints","Validate status at the controller/DTO layer with a validator","Document allowed status codes in the API contract"],"tags":["enum","validation","status","business-exception"],"backgroundTag":"invalid-enum-value","analyzedSha":"781281a9503332ed3cef44ea618349d14230a127","analyzedAt":"2026-09-10T10:59:02.070Z","contentChangedAt":"2026-09-10T10:59:02.070Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}