jeecgboot/JeecgBoot · warning · JeecgBootException
assignedOwen
Error message
assignedOwen
What it means
exitUserTenant throws the literal string 'assignedOwen' (a typo for 'assignedOwner') as a sentinel/control-flow signal when the exiting user is the tenant creator (sysTenant.createBy equals username) AND the tenant has more than one member. This is not a user-facing error — the frontend controller catches it to redirect to the 'assign new owner' workflow. JeecgBootException is abused as a flow-control channel.
Source
Thrown at jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysTenantServiceImpl.java:347
return 1000;
}
}
}
@Override
public void exitUserTenant(String userId, String username, String tenantId) {
int tId = Integer.parseInt(tenantId);
//获取所有租户信息
List<String> userIdsByTenantId = userTenantMapper.getUserIdsByTenantId(tId);
//查询当前租户是否为拥有者
SysTenant sysTenant = tenantMapper.selectById(tId);
//如果是拥有着
if (username.equals(sysTenant.getCreateBy())) {
//判断当前租户信息位数
if (null != userIdsByTenantId && userIdsByTenantId.size() > 1) {
//需要指配拥有者
throw new JeecgBootException("assignedOwen");
} else if (null != userIdsByTenantId && userIdsByTenantId.size() == 1) {
//只有拥有者的时候需要去注销租户
throw new JeecgBootException("cancelTenant");
} else {
throw new JeecgBootException("退出租户失败,租户信息已不存在");
}
} else {
//不是拥有者直接删除
this.leaveTenant(userId, tenantId);
this.leveUserProcess(userId, tenantId);
}
}
@Override
public void changeOwenUserTenant(String userId, String tId) {
//查询当前用户是否存在该租户下
// 代码逻辑说明: 租户id应该是传过来的,不应该是当前租户的------------
int tenantId = oConvertUtils.getInt(tId, 0);View on GitHub (pinned to 96fb33f5ec)
Solutions
- Follow the owner-transfer flow: call changeOwenUserTenant(newOwnerId, tenantId) to assign a new owner, then exit.
- If consuming the API directly, catch JeecgBootException with message 'assignedOwen' and prompt the user to choose a successor.
- Fix the sentinel typo upstream to 'assignedOwner' and update all matching catch sites (defensive: match on a constant, not the literal).
- As owner, first remove/transfer other members if you intend to exit, reducing size to 1 (which routes to cancelTenant).
Example fix
// before
tenantService.exitUserTenant(userId, username, tenantId);
// after
try {
tenantService.exitUserTenant(userId, username, tenantId);
} catch (JeecgBootException e) {
if ("assignedOwen".equals(e.getMessage())) {
// redirect to assign-new-owner flow
return Result.OK("ASSIGN_OWNER", null);
}
throw e;
} Defensive patterns
Strategy: try-catch
Try / catch
try {
tenantService.exitUserTenant(userId, username, tenantId);
} catch (JeecgBootException e) {
if ("assignedOwen".equals(e.getMessage())) {
return Result.OK("ASSIGN_OWNER", null);
}
throw e;
} Prevention
- Always transfer ownership (changeOwenUserTenant) before the owner exits a multi-member tenant.
- Handle the 'assignedOwen' sentinel explicitly in the controller/frontend.
- Refactor upstream to use a result code instead of a thrown sentinel string.
When it happens
Trigger: The tenant owner (createBy) calls exit-user-tenant while other members still belong to the tenant (userIdsByTenantId.size() > 1). The service refuses to leave the tenant ownerless and signals that a successor must be designated first.
Common situations: Owner clicks 'exit tenant' in the UI without first transferring ownership; an automation/script calls exitUserTenant for the owner without the assign-owner step; the frontend handler for 'assignedOwen' is missing or misnamed due to the typo.
Related errors
AI-assisted analysis of jeecgboot/JeecgBoot@96fb33f5ec (2026-08-14).
Data as JSON: /api/errors/38fa8c074880104a.
Report an issue: GitHub.