zabetak commented on code in PR #4430:
URL: https://github.com/apache/hive/pull/4430#discussion_r1238325450
##########
kafka-handler/src/java/org/apache/hadoop/hive/kafka/KafkaUtils.java:
##########
@@ -397,4 +421,31 @@ static void addKerberosJaasConf(Configuration
configuration, Properties props) {
}
log.info("Kafka client running with following JAAS = [{}]", jaasConf);
}
+
+ /**
+ * Returns the security protocol if one is defined in the properties and
null otherwise.
+ * <p>The following properties are examined to determine the protocol:</p>
+ * <ol>
+ * <li>security.protocol</li>
+ * <li>kafka.consumer.security.protocol</li>
+ * <li>kafka.producer.security.protocol</li>
+ * </ol>
+ * <p>and the first non null/not empty is returned.</p>
+ * <p>Defining multiple security protocols at the same time is invalid but
this method is lenient and tries to pick
+ * the most reasonable option.</p>
+ * @param props the properties from which to obtain the protocol.
+ * @return the security protocol if one is defined in the properties and
null otherwise.
+ */
+ static SecurityProtocol securityProtocol(Properties props) {
Review Comment:
Adding `extract` will make the method name longer and more verbose.
```java
if (securityProtocol(props) == SAML_SSL)
// vs
if (extractSecurityProtocol(props) == SAML_SSL)
```
I find the shorter variant more readable and equally expressive so I would
be inclined to keep it as is.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]