{"record":{"id":"c36c53fac29e43f0","repo":"paascloud/paascloud-master","slug":"uac10012004","errorCode":"UAC10012004","errorMessage":"ErrorCodeEnum.UAC10012004","messagePattern":"ErrorCodeEnum\\.UAC10012004","errorType":"error_code","errorClass":"UacBizException","httpStatus":null,"severity":"error","filePath":"paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacRoleUserServiceImpl.java","lineNumber":115,"sourceCode":"\t\treturn uacRoleUserMapper.listByRoleIdList(idList);\n\t}\n\n\t@Override\n\t@Transactional(readOnly = true, rollbackFor = Exception.class)\n\tpublic List<Long> listSuperUser(Long superManagerRoleId) {\n\t\tif (superManagerRoleId == null) {\n\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10012001);\n\t\t}\n\t\treturn uacRoleUserMapper.listSuperUser(superManagerRoleId);\n\t}\n\n\t@Override\n\tpublic void deleteExcludeSuperMng(Long roleId, Long superManagerRoleId) {\n\t\tif (roleId == null) {\n\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10012001);\n\t\t}\n\t\tif (superManagerRoleId == null) {\n\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10012004);\n\t\t}\n\t\tuacRoleUserMapper.deleteExcludeSuperMng(roleId, superManagerRoleId);\n\n\t}\n\n\t@Override\n\t@Transactional(readOnly = true, rollbackFor = Exception.class)\n\tpublic List<UacRoleUser> listByUserId(Long userId) {\n\t\tif (userId == null) {\n\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10011001);\n\t\t}\n\t\treturn uacRoleUserMapper.listByUserId(userId);\n\t}\n\n\t@Override\n\tpublic void deleteByRoleIdList(List<Long> roleIdList) {\n\t\tPreconditions.checkArgument(PublicUtil.isNotEmpty(roleIdList), ErrorCodeEnum.UAC10012001.msg());\n\t\tPreconditions.checkArgument(!roleIdList.contains(GlobalConstant.Sys.SUPER_MANAGER_ROLE_ID), \"超级管理员角色不能删除\");","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/paascloud/paascloud-master/blob/781281a9503332ed3cef44ea618349d14230a127/paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacRoleUserServiceImpl.java#L97-L133","documentation":"UacBizException with code UAC10012004 (super-manager role id is null) thrown by deleteExcludeSuperMng when the second argument superManagerRoleId is null. The deletion must know which role is the super-manager role so its bindings are preserved.","triggerScenarios":"Calling deleteExcludeSuperMng(roleId, null) — the super-manager role id was not provided by the caller or its config/constant resolution returned null.","commonSituations":"Configuration missing for the super-manager role; caller hardcodes a lookup that fails; refactoring renamed the constant so a null default is passed.","solutions":["Pass the correct super-manager role id (e.g. GlobalConstant.Sys.SUPER_MANAGER_ROLE_ID).","Verify configuration/seed data that defines the super-manager role id.","Fail fast at startup if the super-manager role id cannot be resolved."],"exampleFix":"// before\nuacRoleUserService.deleteExcludeSuperMng(roleId, resolveSuperRoleId());\n// after\nLong superRoleId = resolveSuperRoleId();\nPreconditions.checkNotNull(superRoleId, \"超级管理员角色ID未配置\");\nuacRoleUserService.deleteExcludeSuperMng(roleId, superRoleId);","handlingStrategy":"validation","validationCode":"Preconditions.checkNotNull(superManagerRoleId, \"超级管理员角色ID未配置\");\nuacRoleUserService.deleteExcludeSuperMng(roleId, superManagerRoleId);","typeGuard":"boolean canDelete = roleId != null && superManagerRoleId != null;","tryCatchPattern":"try {\n    uacRoleUserService.deleteExcludeSuperMng(roleId, superManagerRoleId);\n} catch (UacBizException e) {\n    if (\"UAC10012004\".equals(e.getCode())) { throw new IllegalStateException(\"super manager role id not configured\", e); }\n    throw e;\n}","preventionTips":["Always source the super-manager role id from the shared constant or verified config","Assert config completeness at startup","Avoid ad-hoc lookups that can return null for this id"],"tags":["null-argument","role-management","configuration"],"backgroundTag":"null-argument","analyzedSha":"781281a9503332ed3cef44ea618349d14230a127","analyzedAt":"2026-09-10T10:59:02.070Z","contentChangedAt":"2026-09-10T10:59:02.070Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}