paascloud/paascloud-master · error · UacBizException

UAC10012004

UAC10012004

Error message

ErrorCodeEnum.UAC10012004

What it means

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.

Solutions

  1. Pass the correct super-manager role id (e.g. GlobalConstant.Sys.SUPER_MANAGER_ROLE_ID).
  2. Verify configuration/seed data that defines the super-manager role id.
  3. Fail fast at startup if the super-manager role id cannot be resolved.

Example fix

// before
uacRoleUserService.deleteExcludeSuperMng(roleId, resolveSuperRoleId());
// after
Long superRoleId = resolveSuperRoleId();
Preconditions.checkNotNull(superRoleId, "超级管理员角色ID未配置");
uacRoleUserService.deleteExcludeSuperMng(roleId, superRoleId);
Defensive patterns

Strategy: validation

Validate before calling

Preconditions.checkNotNull(superManagerRoleId, "超级管理员角色ID未配置");
uacRoleUserService.deleteExcludeSuperMng(roleId, superManagerRoleId);

Type guard

boolean canDelete = roleId != null && superManagerRoleId != null;

Try / catch

try {
    uacRoleUserService.deleteExcludeSuperMng(roleId, superManagerRoleId);
} catch (UacBizException e) {
    if ("UAC10012004".equals(e.getCode())) { throw new IllegalStateException("super manager role id not configured", e); }
    throw e;
}

Prevention

When it happens

Trigger: Calling deleteExcludeSuperMng(roleId, null) — the super-manager role id was not provided by the caller or its config/constant resolution returned null.

Common situations: Configuration missing for the super-manager role; caller hardcodes a lookup that fails; refactoring renamed the constant so a null default is passed.

Related errors


AI-assisted analysis of paascloud/paascloud-master@781281a950 (2026-09-10). Data as JSON: /api/errors/c36c53fac29e43f0. Report an issue: GitHub.

Appendix: source

Thrown at paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacRoleUserServiceImpl.java:115

		return uacRoleUserMapper.listByRoleIdList(idList);
	}

	@Override
	@Transactional(readOnly = true, rollbackFor = Exception.class)
	public List<Long> listSuperUser(Long superManagerRoleId) {
		if (superManagerRoleId == null) {
			throw new UacBizException(ErrorCodeEnum.UAC10012001);
		}
		return uacRoleUserMapper.listSuperUser(superManagerRoleId);
	}

	@Override
	public void deleteExcludeSuperMng(Long roleId, Long superManagerRoleId) {
		if (roleId == null) {
			throw new UacBizException(ErrorCodeEnum.UAC10012001);
		}
		if (superManagerRoleId == null) {
			throw new UacBizException(ErrorCodeEnum.UAC10012004);
		}
		uacRoleUserMapper.deleteExcludeSuperMng(roleId, superManagerRoleId);

	}

	@Override
	@Transactional(readOnly = true, rollbackFor = Exception.class)
	public List<UacRoleUser> listByUserId(Long userId) {
		if (userId == null) {
			throw new UacBizException(ErrorCodeEnum.UAC10011001);
		}
		return uacRoleUserMapper.listByUserId(userId);
	}

	@Override
	public void deleteByRoleIdList(List<Long> roleIdList) {
		Preconditions.checkArgument(PublicUtil.isNotEmpty(roleIdList), ErrorCodeEnum.UAC10012001.msg());
		Preconditions.checkArgument(!roleIdList.contains(GlobalConstant.Sys.SUPER_MANAGER_ROLE_ID), "超级管理员角色不能删除");

View on GitHub (pinned to 781281a950)