This is an automated email from the ASF dual-hosted git repository.
zihaoxiang pushed a commit to branch 3.1.6-prepare
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/3.1.6-prepare by this push:
new 8829bea86d [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)
8829bea86d is described below
commit 8829bea86d69e8ede62aa5a0da5af0de9042c610
Author: LiJie20190102 <[email protected]>
AuthorDate: Wed Apr 19 16:22:16 2023 +0800
[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 <[email protected]>
---
.../dolphinscheduler/service/process/ProcessServiceImpl.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git
a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
index 98cfe5e39e..9a5780aaf2 100644
---
a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
+++
b/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());