chia7712 commented on code in PR #13452:
URL: https://github.com/apache/kafka/pull/13452#discussion_r1149136794


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/FetchConfig.java:
##########
@@ -101,8 +103,8 @@ public FetchConfig(ConsumerConfig config,
         this.maxPollRecords = 
config.getInt(ConsumerConfig.MAX_POLL_RECORDS_CONFIG);
         this.checkCrcs = config.getBoolean(ConsumerConfig.CHECK_CRCS_CONFIG);
         this.clientRackId = 
config.getString(ConsumerConfig.CLIENT_RACK_CONFIG);
-        this.keyDeserializer = keyDeserializer;
-        this.valueDeserializer = valueDeserializer;
+        this.keyDeserializer = Objects.requireNonNull(keyDeserializer, 
"Message key deserializer provided to FetchConfig should not be null");

Review Comment:
   nit: how about calling another constructor to reduce duplicate code? 
   ```java
           this(config.getInt(ConsumerConfig.FETCH_MIN_BYTES_CONFIG),
                   config.getInt(ConsumerConfig.FETCH_MAX_BYTES_CONFIG),
                   config.getInt(ConsumerConfig.FETCH_MAX_WAIT_MS_CONFIG)
                           ...)
   ```



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