Skip to content

Commit

Permalink
[hotfix] fix config parse issue when integration with web
Browse files Browse the repository at this point in the history
  • Loading branch information
liunaijie committed Nov 1, 2024
1 parent a8d0d4c commit 3bef920
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<String, Object> configMap = JsonUtils.toMap(jsonNodes);
List<Map<String, Object>> sources =
(ArrayList<Map<String, Object>>) configMap.get(Constants.SOURCE);
List<Map<String, Object>> sinks =
(ArrayList<Map<String, Object>>) configMap.get(Constants.SINK);
Object sourceObj = configMap.get(Constants.SOURCE);
List<Map<String, Object>> sources;
if (sourceObj instanceof Map) {
sources = Collections.singletonList((Map<String, Object>) sourceObj);
} else {
sources = (ArrayList<Map<String, Object>>) sourceObj;
}
List<Map<String, Object>> sinks;
Object sinkObj = configMap.get(Constants.SINK);
if (sinkObj instanceof Map) {
sinks = Collections.singletonList((Map<String, Object>) sinkObj);
} else {
sinks = (ArrayList<Map<String, Object>>) sinkObj;
}
Preconditions.checkArgument(
!sources.isEmpty(), "Miss <Source> config! Please check the config file.");
Preconditions.checkArgument(
Expand Down

0 comments on commit 3bef920

Please sign in to comment.