You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "chia7712 (via GitHub)" <gi...@apache.org> on 2023/03/27 10:52:00 UTC
[GitHub] [kafka] chia7712 commented on a diff in pull request #13452: KAFKA-14848: KafkaConsumer incorrectly passes locally-scoped deserializers to FetchConfig
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org