This is an automated email from the ASF dual-hosted git repository.

wenjun pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new 8a35e8b2f8 Fix switch task will throw exception when there is not 
parameters (#15594)
8a35e8b2f8 is described below

commit 8a35e8b2f83099ec7536c30633663b43933d6c43
Author: Wenjun Ruan <[email protected]>
AuthorDate: Mon Feb 19 11:12:22 2024 +0800

    Fix switch task will throw exception when there is not parameters (#15594)
---
 .../apache/dolphinscheduler/server/master/utils/SwitchTaskUtils.java | 2 +-
 .../dolphinscheduler/server/master/utils/SwitchTaskUtilsTest.java    | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git 
a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/utils/SwitchTaskUtils.java
 
b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/utils/SwitchTaskUtils.java
index f4ebd0c60c..40686474a4 100644
--- 
a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/utils/SwitchTaskUtils.java
+++ 
b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/utils/SwitchTaskUtils.java
@@ -66,7 +66,7 @@ public class SwitchTaskUtils {
                                                        Map<String, Property> 
varParams) {
         String content = condition.replaceAll("'", "\"");
         if (MapUtils.isEmpty(globalParams) && MapUtils.isEmpty(varParams)) {
-            throw new IllegalArgumentException("globalParams and varParams are 
both empty, please check it.");
+            return content;
         }
         Map<String, Property> params = Maps.newHashMap();
         if (MapUtils.isNotEmpty(globalParams)) {
diff --git 
a/dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/utils/SwitchTaskUtilsTest.java
 
b/dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/utils/SwitchTaskUtilsTest.java
index 18e97f8e80..e0654882ec 100644
--- 
a/dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/utils/SwitchTaskUtilsTest.java
+++ 
b/dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/utils/SwitchTaskUtilsTest.java
@@ -34,9 +34,8 @@ public class SwitchTaskUtilsTest {
         String content = "${test}==1";
         Map<String, Property> globalParams = new HashMap<>();
         Map<String, Property> varParams = new HashMap<>();
-        Assertions.assertThrowsExactly(IllegalArgumentException.class, () -> {
-            SwitchTaskUtils.generateContentWithTaskParams(content, 
globalParams, varParams);
-        });
+        Assertions.assertDoesNotThrow(
+                () -> SwitchTaskUtils.generateContentWithTaskParams(content, 
globalParams, varParams));
 
         globalParams.put("test", new Property("test", Direct.IN, 
DataType.INTEGER, "1"));
         String result = SwitchTaskUtils.generateContentWithTaskParams(content, 
globalParams, varParams);

Reply via email to