RivenSun2 commented on code in PR #12010:
URL: https://github.com/apache/kafka/pull/12010#discussion_r856211769


##########
clients/src/main/java/org/apache/kafka/clients/CommonClientConfigs.java:
##########
@@ -203,4 +205,15 @@ public static Map<String, Object> 
postProcessReconnectBackoffConfigs(AbstractCon
         }
         return rval;
     }
+
+    public static void postValidateSaslMechanismConfig(AbstractConfig config) {
+        SecurityProtocol securityProtocol = 
SecurityProtocol.forName(config.getString(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG));
+        String clientSaslMechanism = 
config.getString(SaslConfigs.SASL_MECHANISM);
+        if (securityProtocol == SecurityProtocol.SASL_PLAINTEXT || 
securityProtocol == SecurityProtocol.SASL_SSL) {
+            if (clientSaslMechanism == null || 
clientSaslMechanism.trim().isEmpty()) {

Review Comment:
   Strings containing only spaces are also considered illegal values, as 
indicated in the corresponding testCase.
   
   ```
           configs.put(SaslConfigs.SASL_MECHANISM, " ");
           ce = assertThrows(ConfigException.class, () -> new 
ConsumerConfig(configs));
   ```



-- 
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