This is an automated email from the ASF dual-hosted git repository.
gallardot 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 79f686f736 [Improvement-17267] Throw exception if deserialize json
failed in JSONUtils (#17243)
79f686f736 is described below
commit 79f686f7365ac17a543edec621fd44eb1b2f3027
Author: Wenjun Ruan <[email protected]>
AuthorDate: Thu Jun 26 10:18:12 2025 +0800
[Improvement-17267] Throw exception if deserialize json failed in JSONUtils
(#17243)
---
.../plugin/alert/email/ExcelUtilsTest.java | 9 +-
.../plugin/alert/feishu/FeiShuSenderTest.java | 16 +-
.../alert/runner/AlertSenderTest.java | 3 +-
.../api/service/impl/EnvironmentServiceImpl.java | 9 +-
.../api/service/impl/UsersServiceImpl.java | 4 +-
.../api/service/WorkflowInstanceServiceTest.java | 1 +
.../common/constants/SystemConstants.java | 32 ++++
.../dolphinscheduler/common/utils/JSONUtils.java | 84 ++++----
.../common/utils/JSONUtilsTest.java | 78 +++++++-
.../src/test/resources/logback.xml | 21 ++
.../src/test/resources/logback.xml | 21 ++
.../extract/base/serialize/JsonSerializer.java | 4 +-
.../src/test/resources/logback.xml | 21 ++
.../cases/WorkflowSchedulingTestCase.java | 4 +-
.../spi/params/PluginParamsTransfer.java | 3 +-
.../plugin/task/api/model/JSONUtilsTest.java | 211 +--------------------
.../src/test/resources/logback.xml | 21 ++
.../src/test/resources/logback.xml | 21 ++
.../src/test/resources/logback.xml | 21 ++
.../src/test/resources/logback.xml | 21 ++
.../plugin/task/emr/AbstractEmrTask.java | 4 +-
.../src/test/resources/logback.xml | 21 ++
22 files changed, 334 insertions(+), 296 deletions(-)
diff --git
a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/ExcelUtilsTest.java
b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/ExcelUtilsTest.java
index f28df77de9..a7d6b01824 100644
---
a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/ExcelUtilsTest.java
+++
b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/ExcelUtilsTest.java
@@ -17,8 +17,6 @@
package org.apache.dolphinscheduler.plugin.alert.email;
-import
org.apache.dolphinscheduler.plugin.alert.email.exception.AlertEmailException;
-
import java.io.File;
import java.nio.file.Path;
@@ -35,7 +33,7 @@ public class ExcelUtilsTest {
private String xlsFilePath;
@BeforeEach
- public void setUp() throws Exception {
+ public void setUp() {
xlsFilePath = testFolder.toString();
}
@@ -58,9 +56,8 @@ public class ExcelUtilsTest {
Assertions.assertTrue(xlsFile.exists());
// Invoke genExcelFile with incorrectContent, will cause
RuntimeException
- Assertions.assertThrows(AlertEmailException.class, () -> {
- ExcelUtils.genExcelFile(incorrectContent1, title, xlsFilePath);
- });
+ Assertions.assertThrows(IllegalArgumentException.class,
+ () -> ExcelUtils.genExcelFile(incorrectContent1, title,
xlsFilePath));
}
diff --git
a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/test/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuSenderTest.java
b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/test/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuSenderTest.java
index 20800cd724..8e582260ff 100644
---
a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/test/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuSenderTest.java
+++
b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/test/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuSenderTest.java
@@ -76,24 +76,22 @@ public class FeiShuSenderTest {
public void testSendWithFormatException() {
AlertData alertData = new AlertData();
alertData.setTitle("feishu test title");
- alertData.setContent("feishu test content");
- FeiShuSender feiShuSender = new FeiShuSender(feiShuConfig);
- String alertResult = feiShuSender.formatContent(alertData);
- Assertions.assertEquals(alertResult, alertData.getTitle() +
alertData.getContent());
+ alertData.setContent("[{\"content\":\"feishu test content\"}]");
+ String alertResult = FeiShuSender.formatContent(alertData);
+ Assertions.assertEquals(alertResult, "`feishu test
title`\ncontent:feishu test content\n");
}
@Test
public void testCheckSendFeiShuSendMsgResult() {
- FeiShuSender feiShuSender = new FeiShuSender(feiShuConfig);
- AlertResult alertResult =
feiShuSender.checkSendFeiShuSendMsgResult("");
+ AlertResult alertResult =
FeiShuSender.checkSendFeiShuSendMsgResult("");
Assertions.assertFalse(alertResult.isSuccess());
- AlertResult alertResult2 =
feiShuSender.checkSendFeiShuSendMsgResult("123");
- Assertions.assertEquals("send feishu msg error: feishu server resp
parse error is null.",
+ AlertResult alertResult2 =
FeiShuSender.checkSendFeiShuSendMsgResult("{\"code\":123}");
+ Assertions.assertEquals("alert send feishu msg error: null",
alertResult2.getMessage());
String response = "{\"code\":\"0\",\"data\":{},\"msg\":\"success\"}";
- AlertResult alertResult3 =
feiShuSender.checkSendFeiShuSendMsgResult(response);
+ AlertResult alertResult3 =
FeiShuSender.checkSendFeiShuSendMsgResult(response);
Assertions.assertTrue(alertResult3.isSuccess());
}
}
diff --git
a/dolphinscheduler-alert/dolphinscheduler-alert-server/src/test/java/org/apache/dolphinscheduler/alert/runner/AlertSenderTest.java
b/dolphinscheduler-alert/dolphinscheduler-alert-server/src/test/java/org/apache/dolphinscheduler/alert/runner/AlertSenderTest.java
index 63346260ca..18246f485a 100644
---
a/dolphinscheduler-alert/dolphinscheduler-alert-server/src/test/java/org/apache/dolphinscheduler/alert/runner/AlertSenderTest.java
+++
b/dolphinscheduler-alert/dolphinscheduler-alert-server/src/test/java/org/apache/dolphinscheduler/alert/runner/AlertSenderTest.java
@@ -96,11 +96,10 @@ class AlertSenderTest {
// 2.alert plugin does not exist
int pluginDefineId = 1;
- String pluginInstanceParams = "alert-instance-mail-params";
String pluginInstanceName = "alert-instance-mail";
List<AlertPluginInstance> alertInstanceList = new ArrayList<>();
AlertPluginInstance alertPluginInstance = new AlertPluginInstance(
- pluginDefineId, pluginInstanceParams, pluginInstanceName);
+ pluginDefineId, PLUGIN_INSTANCE_PARAMS, pluginInstanceName);
alertPluginInstance.setId(1);
alertInstanceList.add(alertPluginInstance);
when(alertDao.listInstanceByAlertGroupId(1)).thenReturn(alertInstanceList);
diff --git
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/EnvironmentServiceImpl.java
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/EnvironmentServiceImpl.java
index 2eb8f84810..b604fd7c1a 100644
---
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/EnvironmentServiceImpl.java
+++
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/EnvironmentServiceImpl.java
@@ -475,10 +475,11 @@ public class EnvironmentServiceImpl extends
BaseServiceImpl implements Environme
if (StringUtils.isEmpty(config)) {
throw new ServiceException(Status.ENVIRONMENT_CONFIG_IS_NULL);
}
- if (!StringUtils.isEmpty(workerGroups)) {
- List<String> workerGroupList = JSONUtils.parseObject(workerGroups,
new TypeReference<List<String>>() {
- });
- if (Objects.isNull(workerGroupList)) {
+ if (StringUtils.isNotEmpty(workerGroups)) {
+ try {
+ JSONUtils.parseObject(workerGroups, new
TypeReference<List<String>>() {
+ });
+ } catch (IllegalArgumentException e) {
throw new
ServiceException(Status.ENVIRONMENT_WORKER_GROUPS_IS_INVALID);
}
}
diff --git
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
index 1c183f87a7..2f499af17a 100644
---
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
+++
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
@@ -28,6 +28,7 @@ import org.apache.dolphinscheduler.api.utils.CheckUtils;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.constants.Constants;
+import org.apache.dolphinscheduler.common.constants.SystemConstants;
import org.apache.dolphinscheduler.common.enums.AuthorizationType;
import org.apache.dolphinscheduler.common.enums.Flag;
import org.apache.dolphinscheduler.common.enums.UserType;
@@ -63,7 +64,6 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
-import java.util.TimeZone;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
@@ -891,7 +891,7 @@ public class UsersServiceImpl extends BaseServiceImpl
implements UsersService {
// add system default timezone if not user timezone
if (StringUtils.isEmpty(user.getTimeZone())) {
- user.setTimeZone(TimeZone.getDefault().toZoneId().getId());
+
user.setTimeZone(SystemConstants.DEFAULT_TIME_ZONE.toZoneId().getId());
}
// remove password
diff --git
a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/WorkflowInstanceServiceTest.java
b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/WorkflowInstanceServiceTest.java
index 767d204305..e5d953a0ac 100644
---
a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/WorkflowInstanceServiceTest.java
+++
b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/WorkflowInstanceServiceTest.java
@@ -480,6 +480,7 @@ public class WorkflowInstanceServiceTest {
taskInstanceContext.setContextType(ContextType.DEPENDENT_RESULT_CONTEXT);
DependentResultTaskInstanceContext dependentResultTaskInstanceContext =
new DependentResultTaskInstanceContext();
+
dependentResultTaskInstanceContext.setContextType(ContextType.DEPENDENT_RESULT_CONTEXT);
dependentResultTaskInstanceContext.setProjectCode(projectCode);
dependentResultTaskInstanceContext.setDependentResult(DependResult.SUCCESS);
taskInstanceContext.setTaskInstanceContext(
diff --git
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/constants/SystemConstants.java
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/constants/SystemConstants.java
new file mode 100644
index 0000000000..c888d5b7f7
--- /dev/null
+++
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/constants/SystemConstants.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dolphinscheduler.common.constants;
+
+import java.util.TimeZone;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class SystemConstants {
+
+ public static final TimeZone DEFAULT_TIME_ZONE = TimeZone.getDefault();
+
+ static {
+ log.info("init timezone: {}", DEFAULT_TIME_ZONE);
+ }
+}
diff --git
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/JSONUtils.java
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/JSONUtils.java
index bae7cb880c..fb417cb64d 100644
---
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/JSONUtils.java
+++
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/JSONUtils.java
@@ -25,6 +25,8 @@ import static
com.fasterxml.jackson.databind.SerializationFeature.FAIL_ON_EMPTY_
import static java.nio.charset.StandardCharsets.UTF_8;
import static
org.apache.dolphinscheduler.common.constants.DateConstants.YYYY_MM_DD_HH_MM_SS;
+import org.apache.dolphinscheduler.common.constants.SystemConstants;
+
import org.apache.commons.lang3.StringUtils;
import java.io.IOException;
@@ -69,10 +71,6 @@ import com.google.common.base.Strings;
@Slf4j
public final class JSONUtils {
- static {
- log.info("init timezone: {}", TimeZone.getDefault());
- }
-
private static final ObjectMapper objectMapper = JsonMapper.builder()
.configure(FAIL_ON_UNKNOWN_PROPERTIES, false)
.configure(ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT, true)
@@ -83,7 +81,7 @@ public final class JSONUtils {
.addModule(new SimpleModule()
.addSerializer(LocalDateTime.class, new
LocalDateTimeSerializer())
.addDeserializer(LocalDateTime.class, new
LocalDateTimeDeserializer()))
- .defaultTimeZone(TimeZone.getDefault())
+ .defaultTimeZone(SystemConstants.DEFAULT_TIME_ZONE)
.defaultDateFormat(new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS))
.build();
@@ -110,7 +108,7 @@ public final class JSONUtils {
/**
* json representation of object
*
- * @param object object
+ * @param object object
* @param feature feature
* @return object to json string
*/
@@ -133,13 +131,17 @@ public final class JSONUtils {
* the fields of the specified object are generics, just the object itself
should not be a
* generic type.
*
- * @param json the string from which the object is to be deserialized
+ * @param json the string from which the object is to be deserialized
* @param clazz the class of T
- * @param <T> T
+ * @param <T> T
* @return an object of type T from the string
* classOfT
*/
public static @Nullable <T> T parseObject(String json, Class<T> clazz) {
+ if (clazz == null) {
+ throw new IllegalArgumentException("Class type cannot be null");
+ }
+
if (Strings.isNullOrEmpty(json)) {
return null;
}
@@ -147,17 +149,16 @@ public final class JSONUtils {
try {
return objectMapper.readValue(json, clazz);
} catch (Exception e) {
- log.error("Parse object exception, jsonStr: {}, class: {}", json,
clazz, e);
+ throw new IllegalArgumentException("Parse json: " + json + " to
class: " + clazz.getName() + " failed", e);
}
- return null;
}
/**
- * deserialize
+ * deserialize
*
- * @param src byte array
+ * @param src byte array
* @param clazz class
- * @param <T> deserialize type
+ * @param <T> deserialize type
* @return deserialize type
*/
public static <T> T parseObject(byte[] src, Class<T> clazz) {
@@ -171,12 +172,16 @@ public final class JSONUtils {
/**
* json to list
*
- * @param json json string
+ * @param json json string
* @param clazz class
- * @param <T> T
+ * @param <T> T
* @return list
*/
public static <T> List<T> toList(String json, Class<T> clazz) {
+ if (clazz == null) {
+ throw new IllegalArgumentException("Class type cannot be null");
+ }
+
if (Strings.isNullOrEmpty(json)) {
return Collections.emptyList();
}
@@ -185,10 +190,10 @@ public final class JSONUtils {
CollectionType listType =
objectMapper.getTypeFactory().constructCollectionType(ArrayList.class, clazz);
return objectMapper.readValue(json, listType);
} catch (Exception e) {
- log.error("parse list exception!", e);
+ throw new IllegalArgumentException(
+ "Parse json: " + json + " to list of class: " +
clazz.getName() + " failed", e);
}
- return Collections.emptyList();
}
/**
@@ -222,7 +227,7 @@ public final class JSONUtils {
* node or its child nodes, and returning value it has.
* If no matching field is found in this node or its descendants, returns
null.
*
- * @param jsonNode json node
+ * @param jsonNode json node
* @param fieldName Name of field to look for
* @return Value of first matching node found, if any; null if none
*/
@@ -238,7 +243,6 @@ public final class JSONUtils {
/**
* json to map
- * {@link #toMap(String, Class, Class)}
*
* @param json json
* @return json to map
@@ -248,34 +252,10 @@ public final class JSONUtils {
});
}
- /**
- * json to map
- *
- * @param json json
- * @param classK classK
- * @param classV classV
- * @param <K> K
- * @param <V> V
- * @return to map
- */
- public static <K, V> Map<K, V> toMap(String json, Class<K> classK,
Class<V> classV) {
- if (Strings.isNullOrEmpty(json)) {
- return Collections.emptyMap();
- }
-
- try {
- return objectMapper.readValue(json, new TypeReference<Map<K, V>>()
{
- });
- } catch (Exception e) {
- log.error("json to map exception!", e);
- }
-
- return Collections.emptyMap();
- }
-
/**
* from the key-value generated json to get the str value no matter the
real type of value
- * @param json the json str
+ *
+ * @param json the json str
* @param nodeName key
* @return the str value of key
*/
@@ -305,13 +285,15 @@ public final class JSONUtils {
return null;
}
+ if (type == null) {
+ throw new IllegalArgumentException("Type reference cannot be
null");
+ }
+
try {
return objectMapper.readValue(json, type);
} catch (Exception e) {
- log.error("json to map exception!", e);
+ throw new IllegalArgumentException("Parse json: " + json + " to
type: " + type.getType() + " failed", e);
}
-
- return null;
}
/**
@@ -347,14 +329,12 @@ public final class JSONUtils {
if (obj == null) {
return null;
}
- String json = "";
try {
- json = toJsonString(obj);
+ return toJsonString(obj).getBytes(UTF_8);
} catch (Exception e) {
- log.error("json serialize exception.", e);
+ throw new IllegalArgumentException("Object: " + obj + " to json
serialization exception.", e);
}
- return json.getBytes(UTF_8);
}
public static ObjectNode parseObject(String text) {
diff --git
a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/JSONUtilsTest.java
b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/JSONUtilsTest.java
index 90130bf6bd..d9c1024ba8 100644
---
a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/JSONUtilsTest.java
+++
b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/JSONUtilsTest.java
@@ -18,7 +18,9 @@
package org.apache.dolphinscheduler.common.utils;
import java.time.LocalDateTime;
+import java.time.OffsetDateTime;
import java.time.ZoneId;
+import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
@@ -31,8 +33,10 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
public class JSONUtilsTest {
@@ -92,7 +96,7 @@ public class JSONUtilsTest {
@Test
public void testParseObject() {
Assertions.assertNull(JSONUtils.parseObject(""));
- Assertions.assertNull(JSONUtils.parseObject("foo", String.class));
+ Assertions.assertThrows(IllegalArgumentException.class, () ->
JSONUtils.parseObject("foo", String.class));
}
@Test
@@ -109,10 +113,8 @@ public class JSONUtilsTest {
@Test
public void testToList() {
- Assertions.assertEquals(new ArrayList(),
- JSONUtils.toList("A1B2C3", null));
- Assertions.assertEquals(new ArrayList(),
- JSONUtils.toList("", null));
+ Assertions.assertThrows(IllegalArgumentException.class, () ->
JSONUtils.toList("A1B2C3", null));
+ Assertions.assertEquals(new ArrayList<>(), JSONUtils.toList("",
String.class));
}
@Test
@@ -126,7 +128,7 @@ public class JSONUtilsTest {
Assertions.assertNotEquals(map, JSONUtils.toMap(
"{\n" + "\"bar\": \"foo\"\n" + "}"));
- Assertions.assertNull(JSONUtils.toMap("3"));
+ Assertions.assertThrows(IllegalArgumentException.class, () ->
JSONUtils.toMap("3"));
Assertions.assertNull(JSONUtils.toMap(null));
String str =
"{\"resourceList\":[],\"localParams\":[],\"rawScript\":\"#!/bin/bash\\necho
\\\"shell-1\\\"\"}";
@@ -194,4 +196,68 @@ public class JSONUtilsTest {
Assertions.assertEquals(localDateTime, timeList.get(0));
}
+ @Test
+ public void testNodeString() {
+ Assertions.assertEquals("", JSONUtils.getNodeString("", "key"));
+ Assertions.assertEquals("", JSONUtils.getNodeString("abc", "key"));
+ Assertions.assertEquals("",
JSONUtils.getNodeString("{\"bar\":\"foo\"}", "key"));
+ Assertions.assertEquals("foo",
JSONUtils.getNodeString("{\"bar\":\"foo\"}", "bar"));
+ Assertions.assertEquals("[1,2,3]", JSONUtils.getNodeString("{\"bar\":
[1,2,3]}", "bar"));
+ Assertions.assertEquals("{\"1\":\"2\",\"2\":3}",
+ JSONUtils.getNodeString("{\"bar\": {\"1\":\"2\",\"2\":3}}",
"bar"));
+ }
+
+ @Test
+ public void testCheckJsonValid() {
+ Assertions.assertTrue(JSONUtils.checkJsonValid("3"));
+ Assertions.assertFalse(JSONUtils.checkJsonValid(""));
+ }
+
+ @Test
+ public void testFindValue() {
+ Assertions.assertNull(JSONUtils.findValue(
+ new ArrayNode(new JsonNodeFactory(true)), null));
+ }
+
+ @Test
+ public void dateToString() {
+ TimeZone timeZone = TimeZone.getTimeZone("UTC");
+ TimeZone.setDefault(timeZone);
+ JSONUtils.setTimeZone(timeZone);
+
+ String time = "2022-02-22 13:38:24";
+ Date date = DateUtils.stringToDate(time);
+ String json = JSONUtils.toJsonString(date);
+ Assertions.assertEquals("\"" + time + "\"", json);
+
+ String errorFormatTime = "Tue Feb 22 03:50:00 UTC 2022";
+ Assertions.assertNull(DateUtils.stringToDate(errorFormatTime));
+ }
+
+ @Test
+ public void stringToDate() {
+ TimeZone timeZone = TimeZone.getTimeZone("UTC");
+ TimeZone.setDefault(timeZone);
+ JSONUtils.setTimeZone(timeZone);
+
+ String json = "\"2022-02-22 13:38:24\"";
+ Date date = JSONUtils.parseObject(json, Date.class);
+ Assertions.assertEquals(DateUtils.stringToDate("2022-02-22 13:38:24"),
date);
+
+ }
+
+ @Test
+ public void toOffsetDateTimeNodeTest() {
+ TimeZone timeZone = TimeZone.getTimeZone("UTC");
+ JSONUtils.setTimeZone(timeZone);
+ LocalDateTime localDateTime = LocalDateTime.of(2024, 7, 10, 15, 0, 0);
+ OffsetDateTime offsetDateTime = OffsetDateTime.of(localDateTime,
ZoneOffset.ofHours(0));
+ Map<String, OffsetDateTime> map = new HashMap<>();
+ map.put("time", offsetDateTime);
+ JsonNode jsonNodes = JSONUtils.toJsonNode(map);
+ String s = JSONUtils.toJsonString(jsonNodes);
+
+ String json = "{\"time\":\"2024-07-10T15:00:00Z\"}";
+ Assertions.assertEquals(json, s);
+ }
}
diff --git
a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/resources/logback.xml
b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/resources/logback.xml
new file mode 100644
index 0000000000..9a182a18ef
--- /dev/null
+++
b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/resources/logback.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<configuration scan="true" scanPeriod="120 seconds">
+ <logger name="*" level="ERROR"/>
+</configuration>
diff --git
a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/test/resources/logback.xml
b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/test/resources/logback.xml
new file mode 100644
index 0000000000..6f211959c5
--- /dev/null
+++
b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/test/resources/logback.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<configuration>
+ <logger name="*" level="ERROR"/>
+</configuration>
diff --git
a/dolphinscheduler-extract/dolphinscheduler-extract-base/src/main/java/org/apache/dolphinscheduler/extract/base/serialize/JsonSerializer.java
b/dolphinscheduler-extract/dolphinscheduler-extract-base/src/main/java/org/apache/dolphinscheduler/extract/base/serialize/JsonSerializer.java
index 3450192f62..6c5ff034a8 100644
---
a/dolphinscheduler-extract/dolphinscheduler-extract-base/src/main/java/org/apache/dolphinscheduler/extract/base/serialize/JsonSerializer.java
+++
b/dolphinscheduler-extract/dolphinscheduler-extract-base/src/main/java/org/apache/dolphinscheduler/extract/base/serialize/JsonSerializer.java
@@ -23,12 +23,12 @@ import static
com.fasterxml.jackson.databind.DeserializationFeature.READ_UNKNOWN
import static
com.fasterxml.jackson.databind.MapperFeature.REQUIRE_SETTERS_FOR_GETTERS;
import static
org.apache.dolphinscheduler.common.constants.DateConstants.YYYY_MM_DD_HH_MM_SS;
+import org.apache.dolphinscheduler.common.constants.SystemConstants;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
-import java.util.TimeZone;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
@@ -49,7 +49,7 @@ public class JsonSerializer {
.addModule(new SimpleModule()
.addSerializer(LocalDateTime.class, new
JSONUtils.LocalDateTimeSerializer())
.addDeserializer(LocalDateTime.class, new
JSONUtils.LocalDateTimeDeserializer()))
- .defaultTimeZone(TimeZone.getDefault())
+ .defaultTimeZone(SystemConstants.DEFAULT_TIME_ZONE)
.defaultDateFormat(new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS))
.build();
diff --git
a/dolphinscheduler-extract/dolphinscheduler-extract-base/src/test/resources/logback.xml
b/dolphinscheduler-extract/dolphinscheduler-extract-base/src/test/resources/logback.xml
new file mode 100644
index 0000000000..9a182a18ef
--- /dev/null
+++
b/dolphinscheduler-extract/dolphinscheduler-extract-base/src/test/resources/logback.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<configuration scan="true" scanPeriod="120 seconds">
+ <logger name="*" level="ERROR"/>
+</configuration>
diff --git
a/dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/integration/cases/WorkflowSchedulingTestCase.java
b/dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/integration/cases/WorkflowSchedulingTestCase.java
index 5bae16ce04..4283b8a647 100644
---
a/dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/integration/cases/WorkflowSchedulingTestCase.java
+++
b/dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/integration/cases/WorkflowSchedulingTestCase.java
@@ -20,6 +20,7 @@ package
org.apache.dolphinscheduler.server.master.integration.cases;
import static org.assertj.core.api.Assertions.assertThat;
import static org.awaitility.Awaitility.await;
+import org.apache.dolphinscheduler.common.constants.SystemConstants;
import org.apache.dolphinscheduler.common.enums.FailureStrategy;
import org.apache.dolphinscheduler.common.enums.Priority;
import org.apache.dolphinscheduler.common.enums.ReleaseState;
@@ -37,7 +38,6 @@ import org.apache.commons.lang3.time.DateUtils;
import java.time.Duration;
import java.util.Date;
-import java.util.TimeZone;
import org.assertj.core.api.Condition;
import org.junit.jupiter.api.DisplayName;
@@ -63,7 +63,7 @@ public class WorkflowSchedulingTestCase extends
AbstractMasterIntegrationTestCas
.workflowDefinitionCode(workflow.getCode())
.startTime(new Date())
.endTime(DateUtils.addDays(new Date(), 1))
- .timezoneId(TimeZone.getDefault().getID())
+ .timezoneId(SystemConstants.DEFAULT_TIME_ZONE.getID())
.crontab("0/5 * * * * ?")
.failureStrategy(FailureStrategy.CONTINUE)
.warningType(WarningType.NONE)
diff --git
a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/PluginParamsTransfer.java
b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/PluginParamsTransfer.java
index 7c553e3fd7..cc6e59d818 100644
---
a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/PluginParamsTransfer.java
+++
b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/PluginParamsTransfer.java
@@ -62,7 +62,8 @@ public class PluginParamsTransfer {
* @return return plugin params value
*/
public static List<Map<String, Object>> generatePluginParams(String
paramsJsonStr, String pluginParamsTemplate) {
- Map<String, Object> paramsMap = JSONUtils.toMap(paramsJsonStr,
String.class, Object.class);
+ Map<String, Object> paramsMap = JSONUtils.parseObject(paramsJsonStr,
new TypeReference<Map<String, Object>>() {
+ });
return generatePluginParams(paramsMap, pluginParamsTemplate);
}
diff --git
a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/test/java/org/apache/dolphinscheduler/plugin/task/api/model/JSONUtilsTest.java
b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/test/java/org/apache/dolphinscheduler/plugin/task/api/model/JSONUtilsTest.java
index 9ee4a2c0b6..213fc22ab2 100644
---
a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/test/java/org/apache/dolphinscheduler/plugin/task/api/model/JSONUtilsTest.java
+++
b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/test/java/org/apache/dolphinscheduler/plugin/task/api/model/JSONUtilsTest.java
@@ -17,31 +17,21 @@
package org.apache.dolphinscheduler.plugin.task.api.model;
-import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.plugin.task.api.enums.DataType;
import org.apache.dolphinscheduler.plugin.task.api.enums.Direct;
-import java.time.LocalDateTime;
-import java.time.OffsetDateTime;
-import java.time.ZoneOffset;
import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TimeZone;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.JsonNodeFactory;
-import com.fasterxml.jackson.databind.node.ObjectNode;
+/**
+ * Contains some test case related to Property.
+ */
public class JSONUtilsTest {
@Test
@@ -81,28 +71,6 @@ public class JSONUtilsTest {
}
- @Test
- public void createObjectNodeTest() {
- String jsonStr = "{\"a\":\"b\",\"b\":\"d\"}";
-
- ObjectNode objectNode = JSONUtils.createObjectNode();
- objectNode.put("a", "b");
- objectNode.put("b", "d");
- String s = JSONUtils.toJsonString(objectNode);
- Assertions.assertEquals(s, jsonStr);
- }
-
- @Test
- public void toMap() {
-
- String jsonStr = "{\"id\":\"1001\",\"name\":\"Jobs\"}";
-
- Map<String, String> models = JSONUtils.toMap(jsonStr);
- Assertions.assertEquals("1001", models.get("id"));
- Assertions.assertEquals("Jobs", models.get("name"));
-
- }
-
@Test
public void convert2Property() {
Property property = new Property();
@@ -115,177 +83,4 @@ public class JSONUtilsTest {
Direct direct = property1.getDirect();
Assertions.assertEquals(Direct.IN, direct);
}
-
- @Test
- public void string2MapTest() {
- String str = list2String();
-
- List<LinkedHashMap> maps = JSONUtils.toList(str,
- LinkedHashMap.class);
-
- Assertions.assertEquals(1, maps.size());
- Assertions.assertEquals("mysql200", maps.get(0).get("mysql service
name"));
- Assertions.assertEquals("192.168.xx.xx", maps.get(0).get("mysql
address"));
- Assertions.assertEquals("3306", maps.get(0).get("port"));
- Assertions.assertEquals("80", maps.get(0).get("no index of number"));
- Assertions.assertEquals("190", maps.get(0).get("database client
connections"));
- }
-
- public String list2String() {
-
- LinkedHashMap<String, String> map1 = new LinkedHashMap<>();
- map1.put("mysql service name", "mysql200");
- map1.put("mysql address", "192.168.xx.xx");
- map1.put("port", "3306");
- map1.put("no index of number", "80");
- map1.put("database client connections", "190");
-
- List<LinkedHashMap<String, String>> maps = new ArrayList<>();
- maps.add(0, map1);
- String resultJson = JSONUtils.toJsonString(maps);
- return resultJson;
- }
-
- @Test
- public void testParseObject() {
- Assertions.assertNull(JSONUtils.parseObject(""));
- Assertions.assertNull(JSONUtils.parseObject("foo", String.class));
- }
-
- @Test
- public void testNodeString() {
- Assertions.assertEquals("", JSONUtils.getNodeString("", "key"));
- Assertions.assertEquals("", JSONUtils.getNodeString("abc", "key"));
- Assertions.assertEquals("",
JSONUtils.getNodeString("{\"bar\":\"foo\"}", "key"));
- Assertions.assertEquals("foo",
JSONUtils.getNodeString("{\"bar\":\"foo\"}", "bar"));
- Assertions.assertEquals("[1,2,3]", JSONUtils.getNodeString("{\"bar\":
[1,2,3]}", "bar"));
- Assertions.assertEquals("{\"1\":\"2\",\"2\":3}",
- JSONUtils.getNodeString("{\"bar\": {\"1\":\"2\",\"2\":3}}",
"bar"));
- }
-
- @Test
- public void testJsonByteArray() {
- String str = "foo";
- byte[] serializeByte = JSONUtils.toJsonByteArray(str);
- String deserialize = JSONUtils.parseObject(serializeByte,
String.class);
- Assertions.assertEquals(str, deserialize);
- str = null;
- serializeByte = JSONUtils.toJsonByteArray(str);
- deserialize = JSONUtils.parseObject(serializeByte, String.class);
- Assertions.assertNull(deserialize);
- }
-
- @Test
- public void testToList() {
- Assertions.assertEquals(new ArrayList(), JSONUtils.toList("A1B2C3",
null));
- Assertions.assertEquals(new ArrayList(), JSONUtils.toList("", null));
- }
-
- @Test
- public void testCheckJsonValid() {
- Assertions.assertTrue(JSONUtils.checkJsonValid("3"));
- Assertions.assertFalse(JSONUtils.checkJsonValid(""));
- }
-
- @Test
- public void testFindValue() {
- Assertions.assertNull(JSONUtils.findValue(
- new ArrayNode(new JsonNodeFactory(true)), null));
- }
-
- @Test
- public void testToMap() {
- Map<String, String> map = new HashMap<>();
- map.put("foo", "bar");
-
- Assertions.assertTrue(map.equals(JSONUtils.toMap(
- "{\n" + "\"foo\": \"bar\"\n" + "}")));
-
- Assertions.assertFalse(map.equals(JSONUtils.toMap(
- "{\n" + "\"bar\": \"foo\"\n" + "}")));
-
- Assertions.assertNull(JSONUtils.toMap("3"));
- Assertions.assertNull(JSONUtils.toMap(null));
-
- String str =
"{\"resourceList\":[],\"localParams\":[],\"rawScript\":\"#!/bin/bash\\necho
\\\"shell-1\\\"\"}";
- Map<String, String> m = JSONUtils.toMap(str);
- Assertions.assertNotNull(m);
- }
-
- @Test
- public void testToJsonString() {
- Map<String, Object> map = new HashMap<>();
- map.put("foo", "bar");
-
- Assertions.assertEquals("{\"foo\":\"bar\"}",
JSONUtils.toJsonString(map));
- Assertions.assertEquals(String.valueOf((Object) null),
JSONUtils.toJsonString(null));
-
- Assertions.assertEquals("{\"foo\":\"bar\"}",
- JSONUtils.toJsonString(map,
SerializationFeature.WRITE_NULL_MAP_VALUES));
- }
-
- @Test
- public void parseObject() {
- String str = "{\"color\":\"yellow\",\"type\":\"renault\"}";
- ObjectNode node = JSONUtils.parseObject(str);
-
- Assertions.assertEquals("yellow", node.path("color").asText());
-
- node.put("price", 100);
- Assertions.assertEquals(100, node.path("price").asInt());
-
- node.put("color", "red");
- Assertions.assertEquals("red", node.path("color").asText());
- }
-
- @Test
- public void parseArray() {
- String str = "[{\"color\":\"yellow\",\"type\":\"renault\"}]";
- ArrayNode node = JSONUtils.parseArray(str);
-
- Assertions.assertEquals("yellow", node.path(0).path("color").asText());
- }
-
- @Test
- public void dateToString() {
- TimeZone timeZone = TimeZone.getTimeZone("UTC");
- TimeZone.setDefault(timeZone);
- JSONUtils.setTimeZone(timeZone);
-
- String time = "2022-02-22 13:38:24";
- Date date = DateUtils.stringToDate(time);
- String json = JSONUtils.toJsonString(date);
- Assertions.assertEquals("\"" + time + "\"", json);
-
- String errorFormatTime = "Tue Feb 22 03:50:00 UTC 2022";
- Assertions.assertNull(DateUtils.stringToDate(errorFormatTime));
- }
-
- @Test
- public void stringToDate() {
- TimeZone timeZone = TimeZone.getTimeZone("UTC");
- TimeZone.setDefault(timeZone);
- JSONUtils.setTimeZone(timeZone);
-
- String json = "\"2022-02-22 13:38:24\"";
- Date date = JSONUtils.parseObject(json, Date.class);
- Assertions.assertEquals(DateUtils.stringToDate("2022-02-22 13:38:24"),
date);
-
- }
-
- @Test
- public void toOffsetDateTimeNodeTest() {
- TimeZone timeZone = TimeZone.getTimeZone("UTC");
- JSONUtils.setTimeZone(timeZone);
- LocalDateTime localDateTime = LocalDateTime.of(2024, 7, 10, 15, 0, 0);
- OffsetDateTime offsetDateTime = OffsetDateTime.of(localDateTime,
ZoneOffset.ofHours(0));
- Map<String, OffsetDateTime> map = new HashMap<>();
- map.put("time", offsetDateTime);
- JsonNode jsonNodes = JSONUtils.toJsonNode(map);
- String s = JSONUtils.toJsonString(jsonNodes);
-
- String json = "{\"time\":\"2024-07-10T15:00:00Z\"}";
- Assertions.assertEquals(json, s);
- }
-
}
diff --git
a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/test/resources/logback.xml
b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/test/resources/logback.xml
new file mode 100644
index 0000000000..9a182a18ef
--- /dev/null
+++
b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/test/resources/logback.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<configuration scan="true" scanPeriod="120 seconds">
+ <logger name="*" level="ERROR"/>
+</configuration>
diff --git
a/dolphinscheduler-task-plugin/dolphinscheduler-task-datafactory/src/test/resources/logback.xml
b/dolphinscheduler-task-plugin/dolphinscheduler-task-datafactory/src/test/resources/logback.xml
new file mode 100644
index 0000000000..9a182a18ef
--- /dev/null
+++
b/dolphinscheduler-task-plugin/dolphinscheduler-task-datafactory/src/test/resources/logback.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<configuration scan="true" scanPeriod="120 seconds">
+ <logger name="*" level="ERROR"/>
+</configuration>
diff --git
a/dolphinscheduler-task-plugin/dolphinscheduler-task-datasync/src/test/resources/logback.xml
b/dolphinscheduler-task-plugin/dolphinscheduler-task-datasync/src/test/resources/logback.xml
new file mode 100644
index 0000000000..9a182a18ef
--- /dev/null
+++
b/dolphinscheduler-task-plugin/dolphinscheduler-task-datasync/src/test/resources/logback.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<configuration scan="true" scanPeriod="120 seconds">
+ <logger name="*" level="ERROR"/>
+</configuration>
diff --git
a/dolphinscheduler-task-plugin/dolphinscheduler-task-dms/src/test/resources/logback.xml
b/dolphinscheduler-task-plugin/dolphinscheduler-task-dms/src/test/resources/logback.xml
new file mode 100644
index 0000000000..9a182a18ef
--- /dev/null
+++
b/dolphinscheduler-task-plugin/dolphinscheduler-task-dms/src/test/resources/logback.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<configuration scan="true" scanPeriod="120 seconds">
+ <logger name="*" level="ERROR"/>
+</configuration>
diff --git
a/dolphinscheduler-task-plugin/dolphinscheduler-task-emr/src/main/java/org/apache/dolphinscheduler/plugin/task/emr/AbstractEmrTask.java
b/dolphinscheduler-task-plugin/dolphinscheduler-task-emr/src/main/java/org/apache/dolphinscheduler/plugin/task/emr/AbstractEmrTask.java
index 412b0b86e8..dd4187f84e 100644
---
a/dolphinscheduler-task-plugin/dolphinscheduler-task-emr/src/main/java/org/apache/dolphinscheduler/plugin/task/emr/AbstractEmrTask.java
+++
b/dolphinscheduler-task-plugin/dolphinscheduler-task-emr/src/main/java/org/apache/dolphinscheduler/plugin/task/emr/AbstractEmrTask.java
@@ -23,6 +23,7 @@ import static
com.fasterxml.jackson.databind.DeserializationFeature.READ_UNKNOWN
import static
com.fasterxml.jackson.databind.MapperFeature.REQUIRE_SETTERS_FOR_GETTERS;
import
org.apache.dolphinscheduler.authentication.aws.AmazonElasticMapReduceClientFactory;
+import org.apache.dolphinscheduler.common.constants.SystemConstants;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.common.utils.PropertyUtils;
import org.apache.dolphinscheduler.plugin.task.api.AbstractRemoteTask;
@@ -30,7 +31,6 @@ import
org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext;
import
org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters;
import java.util.Map;
-import java.util.TimeZone;
import lombok.extern.slf4j.Slf4j;
@@ -62,7 +62,7 @@ public abstract class AbstractEmrTask extends
AbstractRemoteTask {
.configure(ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT, true)
.configure(READ_UNKNOWN_ENUM_VALUES_AS_NULL, true)
.configure(REQUIRE_SETTERS_FOR_GETTERS, true)
- .setTimeZone(TimeZone.getDefault())
+ .setTimeZone(SystemConstants.DEFAULT_TIME_ZONE)
.setPropertyNamingStrategy(new
PropertyNamingStrategy.UpperCamelCaseStrategy());
/**
diff --git
a/dolphinscheduler-task-plugin/dolphinscheduler-task-mlflow/src/test/resources/logback.xml
b/dolphinscheduler-task-plugin/dolphinscheduler-task-mlflow/src/test/resources/logback.xml
new file mode 100644
index 0000000000..9a182a18ef
--- /dev/null
+++
b/dolphinscheduler-task-plugin/dolphinscheduler-task-mlflow/src/test/resources/logback.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<configuration scan="true" scanPeriod="120 seconds">
+ <logger name="*" level="ERROR"/>
+</configuration>