kirktrue commented on code in PR #16899: URL: https://github.com/apache/kafka/pull/16899#discussion_r1859396777
########## clients/src/main/java/org/apache/kafka/clients/consumer/ConsumerConfig.java: ########## @@ -713,9 +734,19 @@ private void maybeOverrideEnableAutoCommit(Map<String, Object> configs) { } } - private void checkGroupRemoteAssignor() { - if (getString(GROUP_PROTOCOL_CONFIG).equalsIgnoreCase(GroupProtocol.CLASSIC.name()) && getString(GROUP_REMOTE_ASSIGNOR_CONFIG) != null && !getString(GROUP_REMOTE_ASSIGNOR_CONFIG).isEmpty()) { - throw new ConfigException(GROUP_REMOTE_ASSIGNOR_CONFIG + " cannot be set when " + GROUP_PROTOCOL_CONFIG + "=" + GroupProtocol.CLASSIC.name()); + private void checkUnsupportedConfigs(GroupProtocol groupProtocol, List<String> unsupportedConfigs) { + List<String> invalidConfigs = new ArrayList<>(); + if (getString(GROUP_PROTOCOL_CONFIG).equalsIgnoreCase(groupProtocol.name())) { + unsupportedConfigs.forEach(configName -> { + Object config = originals().get(configName); + if (config != null && !Utils.isBlank(config.toString())) { + invalidConfigs.add(configName); + } + }); + if (!invalidConfigs.isEmpty()) { + throw new ConfigException(String.join(", ", invalidConfigs) + + " cannot be set when " + GROUP_PROTOCOL_CONFIG + "=" + groupProtocol.name()); + } Review Comment: Nit: no need to create the list if we don't end up using it. ```suggestion if (getString(GROUP_PROTOCOL_CONFIG).equalsIgnoreCase(groupProtocol.name())) { List<String> invalidConfigs = new ArrayList<>(); unsupportedConfigs.forEach(configName -> { Object config = originals().get(configName); if (config != null && !Utils.isBlank(config.toString())) { invalidConfigs.add(configName); } }); if (!invalidConfigs.isEmpty()) { throw new ConfigException(String.join(", ", invalidConfigs) + " cannot be set when " + GROUP_PROTOCOL_CONFIG + "=" + groupProtocol.name()); } ``` -- 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