Copilot commented on code in PR #8945:
URL: https://github.com/apache/seatunnel/pull/8945#discussion_r2020423390
##########
seatunnel-core/seatunnel-core-starter/src/main/java/org/apache/seatunnel/core/starter/utils/ConfigShadeUtils.java:
##########
@@ -173,28 +173,42 @@ private static Config processConfig(
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);
- Preconditions.checkArgument(
- !sources.isEmpty(), "Miss <Source> config! Please check the
config file.");
- Preconditions.checkArgument(
- !sinks.isEmpty(), "Miss <Sink> config! Please check the config
file.");
- sources.forEach(
- source -> {
- for (String sensitiveOption : sensitiveOptions) {
- source.computeIfPresent(sensitiveOption,
processFunction);
- }
- });
- sinks.forEach(
- sink -> {
- for (String sensitiveOption : sensitiveOptions) {
- sink.computeIfPresent(sensitiveOption,
processFunction);
- }
- });
- configMap.put(Constants.SOURCE, sources);
- configMap.put(Constants.SINK, sinks);
+ if (configMap.containsKey(Constants.CONNECTION)) {
+ Map<String, Map<String, Object>> connects =
+ (Map<String, Map<String, Object>>)
configMap.get(Constants.CONNECTION);
+ connects.forEach(
+ (conn_id, connect) -> {
+ Map<String, Object> conn_dit = new
HashMap<>(connect.size());
+ for (String sensitiveOption : sensitiveOptions) {
+ conn_dit.computeIfPresent(sensitiveOption,
processFunction);
+ }
+ connect = conn_dit;
Review Comment:
[nitpick] The variable name 'conn_dit' appears to be a typo; consider
renaming it to 'conn_dict' for clarity.
```suggestion
Map<String, Object> conn_dict = new
HashMap<>(connect.size());
for (String sensitiveOption : sensitiveOptions) {
conn_dict.computeIfPresent(sensitiveOption,
processFunction);
}
connect = conn_dict;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]