From 3bef92045664d77e8d04e6a911010c0b98f5fb1a Mon Sep 17 00:00:00 2001 From: jarvis Date: Fri, 1 Nov 2024 14:38:47 +0800 Subject: [PATCH] [hotfix] fix config parse issue when integration with web --- .../core/starter/utils/ConfigShadeUtils.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/seatunnel-core/seatunnel-core-starter/src/main/java/org/apache/seatunnel/core/starter/utils/ConfigShadeUtils.java b/seatunnel-core/seatunnel-core-starter/src/main/java/org/apache/seatunnel/core/starter/utils/ConfigShadeUtils.java index 3269ab8cd83..711e38949f9 100644 --- a/seatunnel-core/seatunnel-core-starter/src/main/java/org/apache/seatunnel/core/starter/utils/ConfigShadeUtils.java +++ b/seatunnel-core/seatunnel-core-starter/src/main/java/org/apache/seatunnel/core/starter/utils/ConfigShadeUtils.java @@ -34,6 +34,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Base64; +import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -139,10 +140,20 @@ private static Config processConfig(String identifier, Config config, boolean is String jsonString = config.root().render(ConfigRenderOptions.concise()); ObjectNode jsonNodes = JsonUtils.parseObject(jsonString); Map configMap = JsonUtils.toMap(jsonNodes); - List> sources = - (ArrayList>) configMap.get(Constants.SOURCE); - List> sinks = - (ArrayList>) configMap.get(Constants.SINK); + Object sourceObj = configMap.get(Constants.SOURCE); + List> sources; + if (sourceObj instanceof Map) { + sources = Collections.singletonList((Map) sourceObj); + } else { + sources = (ArrayList>) sourceObj; + } + List> sinks; + Object sinkObj = configMap.get(Constants.SINK); + if (sinkObj instanceof Map) { + sinks = Collections.singletonList((Map) sinkObj); + } else { + sinks = (ArrayList>) sinkObj; + } Preconditions.checkArgument( !sources.isEmpty(), "Miss config! Please check the config file."); Preconditions.checkArgument(