[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>
This commit is contained in:
LiJie20190102 2023-04-19 16:22:16 +08:00 committed by GitHub
parent 7e134b24ef
commit 8829bea86d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -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());