EricGao888 commented on code in PR #10303:
URL: https://github.com/apache/dolphinscheduler/pull/10303#discussion_r885179911
##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java:
##########
@@ -651,7 +666,14 @@ private boolean upload(User loginUser, String fullName,
MultipartFile file, Reso
return false;
}
// query tenant
- String tenantCode =
tenantMapper.queryById(loginUser.getTenantId()).getTenantCode();
+ Tenant tenant = tenantMapper.queryById(loginUser.getTenantId());
+ // this could happen when user logs in as admin
+ if (tenant == null) {
+ logger.error("fail to acquire tenant, please set tenant for login
user/admin first");
Review Comment:
> It is a little odd here, since we already have some check func
`getTenantCode`, is there a reason we should add new new on named
`verifyTenant` to do that?
Honestly, I just found there is such a `getTenantCode` check. :rofl: What
about remove the new `verifyTenant` and add `getTenantCode` in `createResource`
to keep consistency? BTW we can keep the unit test to add some coverage.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]