dajac commented on code in PR #13966:
URL: https://github.com/apache/kafka/pull/13966#discussion_r1254348119


##########
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:
   I don't recall why we added this check. I think that the cipher can only be 
set once per connection so this may be the reason. I suppose that it is fine to 
remove it in this case. I am not sure about the `Objects.requireNonNull` though.
   
   As this file is only used in tests, it would also make sense to move it to 
the `test` source tree.



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