paascloud/paascloud-master · error · IllegalArgumentException
权限ID不能为空
Error message
权限ID不能为空
What it means
deleteActionById throws IllegalArgumentException('权限ID不能为空' — 'permission ID cannot be empty') when actionId is null. It is a plain JDK guard, not a business exception, protecting the subsequent mapper lookups from a null primary key.
Solutions
- Ensure the caller supplies a non-null actionId before invoking the service
- Validate/require the id at the controller layer (@NotNull / @RequestParam mandatory)
- Check request JSON field name matches the DTO property
Example fix
// before
uacActionService.deleteActionById(request.getId());
// after
if (request.getId() == null) {
throw new UacBizException(ErrorCodeEnum.UAC10014001, -1L);
}
uacActionService.deleteActionById(request.getId()); Defensive patterns
Strategy: validation
Validate before calling
if (actionId == null) { throw new IllegalArgumentException("actionId must not be null"); } Type guard
null
Try / catch
try { service.deleteActionById(id); } catch (IllegalArgumentException e) { logger.warn("missing action id"); return 0; } Prevention
- Require the id at the API boundary (@NotNull)
- Check request binding logs when ids come back null
- Never construct delete calls from optional fields without checks
When it happens
Trigger: Calling uacActionService.deleteActionById(null), e.g. when the caller's request body or path variable for the action id was never populated.
Common situations: Front-end sends a delete request without the id; controller binding fails silently; batch UI passes null entries.
Related errors
AI-assisted analysis of paascloud/paascloud-master@781281a950 (2026-09-10).
Data as JSON: /api/errors/d03402bb3805b2a4.
Report an issue: GitHub.
Appendix: source
Thrown at paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacActionServiceImpl.java:66
List<Long> menuIdList = actionMainQueryDto.getMenuIdList();
Long menuId = null;
if (PublicUtil.isNotEmpty(menuIdList)) {
menuId = menuIdList.get(menuIdList.size() - 1);
}
UacAction uacAction = new UacAction();
uacAction.setMenuId(menuId);
BeanUtils.copyProperties(actionMainQueryDto, uacAction);
uacAction.setOrderBy("update_time desc");
PageHelper.startPage(actionMainQueryDto.getPageNum(), actionMainQueryDto.getPageSize());
List<ActionVo> actionList = uacActionMapper.queryActionListWithPage(uacAction);
return new PageInfo<>(actionList);
}
@Override
public int deleteActionById(Long actionId) {
//查询该角色下是否有用户绑定, 有的话提醒不能删除
if (null == actionId) {
throw new IllegalArgumentException("权限ID不能为空");
}
UacAction uacAction = uacActionMapper.selectByPrimaryKey(actionId);
if (uacAction == null) {
logger.error("找不到权限信息 actionId={}", actionId);
throw new UacBizException(ErrorCodeEnum.UAC10014001, actionId);
}
// 删除角色权限表数据 不查询了 直接删除了
uacRoleActionMapper.deleteByActionId(actionId);
return uacActionMapper.deleteByPrimaryKey(actionId);
}
@Override
public void batchDeleteByIdList(List<Long> deleteIdList) {
logger.info("批量删除角色. deleteIdList={}", deleteIdList);
Preconditions.checkArgument(PublicUtil.isNotEmpty(deleteIdList), "删除权限ID不能为空");View on GitHub (pinned to 781281a950)