divijvaidya commented on code in PR #13966:
URL: https://github.com/apache/kafka/pull/13966#discussion_r1254327272
##########
clients/src/main/java/org/apache/kafka/common/network/DefaultChannelMetadataRegistry.java:
##########
@@ -16,15 +16,15 @@
*/
package org.apache.kafka.common.network;
+import java.util.Objects;
+
public class DefaultChannelMetadataRegistry implements ChannelMetadataRegistry
{
private CipherInformation cipherInformation;
private ClientInformation clientInformation;
@Override
public void registerCipherInformation(final CipherInformation
cipherInformation) {
- if (this.cipherInformation != null) {
- this.cipherInformation = cipherInformation;
- }
+ this.cipherInformation = Objects.requireNonNull(cipherInformation);
Review Comment:
+1 to add a unit test.
The previous implementation will not update the cipherInformation if one
already exists. This is inconsistent with the implementation in other
implementation of `ChannelMetadataRegistry` i.e.
SelectorChannelMetadataRegistry, hence, makes me believe that the expected
behaviour is to replace the member if it already exists. Note that this file is
only used in tests so far.
--
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]