You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2020/01/03 13:42:09 UTC

[GitHub] [incubator-dolphinscheduler] samz406 commented on a change in pull request #1684: fix get tenantCode my NPE

samz406 commented on a change in pull request #1684: fix get tenantCode my NPE
URL: https://github.com/apache/incubator-dolphinscheduler/pull/1684#discussion_r362812224
 
 

 ##########
 File path: dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
 ##########
 @@ -644,18 +654,20 @@ public Result updateResourceContent(int resourceId, String content) {
         if (StringUtils.isNotEmpty(resourceViewSuffixs)) {
             List<String> strList = Arrays.asList(resourceViewSuffixs.split(","));
             if (!strList.contains(nameSuffix)) {
-                logger.error("resouce suffix {} not support updateProcessInstance,  resource id {}", nameSuffix, resourceId);
+                logger.error("resource suffix {} not support updateProcessInstance,  resource id {}", nameSuffix, resourceId);
                 putMsg(result, Status.RESOURCE_SUFFIX_NOT_SUPPORT_VIEW);
                 return result;
             }
         }
 
+        String tenantCode = getTenantCode(resource.getUserId(),result);
+        if (StringUtils.isEmpty(tenantCode)){
 
 Review comment:
   Since a tenant is required to upload a resource, the resource and tenant are associated through the user. If the user on resouce is illegal. Then the tenant cannot be obtained, and the null pointer exception will be thrown when the tenantCode is obtained.
   
   由于上传resource需要tenant,resource和tenant是通过用户关联,如果resource上的用户是非法的。那么就获取不到tenant了, 获取tenantCode也就会抛空指针异常

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services