OmniaGM commented on code in PR #15597:
URL: https://github.com/apache/kafka/pull/15597#discussion_r1541328444


##########
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/Worker.java:
##########
@@ -925,10 +926,13 @@ static Map<String, Object> adminConfigs(String connName,
         // Ignore configs that begin with "admin." since those will be added 
next (with the prefix stripped)
         // and those that begin with "producer." and "consumer.", since we 
know they aren't intended for
         // the admin client
+        // Also ignore the config.providers configurations because the 
worker-configured ConfigProviders should
+        // already have been evaluated via the trusted WorkerConfig constructor
         Map<String, Object> nonPrefixedWorkerConfigs = 
config.originals().entrySet().stream()
                 .filter(e -> !e.getKey().startsWith("admin.")
                         && !e.getKey().startsWith("producer.")
-                        && !e.getKey().startsWith("consumer."))
+                        && !e.getKey().startsWith("consumer.")
+                        && 
!e.getKey().startsWith(AbstractConfig.CONFIG_PROVIDERS_CONFIG))

Review Comment:
   Small suggestion, as the list of config isn't that huge then I would suggest 
refactoring this to something similar to the following 
   ```
   Stream<String> prefixes = Stream.of("admin.", "producer.", "consumer.", 
AbstractConfig.CONFIG_PROVIDERS_CONFIG);
   Map<String, Object> nonPrefixedWorkerConfigs = 
config.originals().entrySet().stream()
           .filter(e -> prefixes.allMatch(s -> !e.getKey().startsWith(s)))
           .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
   ```
   



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to