Browse Source

[Fix-13596][Task Instance] Throw an error message to tell the user that the file cannot be found instead of NPE during task execution (#13878)

Co-authored-by: lijie0203 <guoxiaoliang@qishudi.com>
3.1.6-release
LiJie20190102 2 years ago committed by GitHub
parent
commit
8829bea86d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java

8
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java

@ -1772,9 +1772,7 @@ public class ProcessServiceImpl implements ProcessService {
JSONUtils.toJsonString(mainJarObj),
ResourceInfo.class);
ResourceInfo resourceInfo = updateResourceInfo(mainJar);
if (resourceInfo != null) {
taskParameters.put("mainJar", resourceInfo);
}
taskParameters.put("mainJar", resourceInfo);
}
// update resourceList information
if (taskParameters.containsKey("resourceList")) {
@ -1810,6 +1808,10 @@ public class ProcessServiceImpl implements ProcessService {
resourceInfo = new ResourceInfo();
// get resource from database, only one resource should be returned
Resource resource = getResourceById(resourceId);
if (Objects.isNull(resource)) {
logger.error("resource not found, resourceId: {}", resourceId);
return null;
}
resourceInfo.setId(resourceId);
resourceInfo.setRes(resource.getFileName());
resourceInfo.setResourceName(resource.getFullName());

Loading…
Cancel
Save