RivenSun2 commented on code in PR #12010:
URL: https://github.com/apache/kafka/pull/12010#discussion_r864331037


##########
clients/src/main/java/org/apache/kafka/clients/consumer/ConsumerConfig.java:
##########
@@ -601,11 +607,16 @@ private void maybeOverrideClientId(Map<String, Object> 
configs) {
     protected static Map<String, Object> 
appendDeserializerToConfig(Map<String, Object> configs,
                                                                     
Deserializer<?> keyDeserializer,
                                                                     
Deserializer<?> valueDeserializer) {
+        // validate deserializer configuration, if the passed deserializer 
instance is null, the user must explicitly set a valid deserializer 
configuration value

Review Comment:
   The situation you describe should be that the key.deserializer parameter is 
not set.
   
   The changes here are to deal with two situations:
   1. As described in JIRA, when the user explicitly sets null, expect a 
`ConfigException` instead of a `NullPointerException`. 
   eg: `props.put("key.serializer", null);`
   
   2. In order to be compatible with the usage scenarios of some users, as 
@C0urante  mentioned, the user will only pass in the serializer instance when 
building the KafkaProducer:
   
   > I'm wondering if people might be constructing ProducerConfig and 
ConsumerConfig instances in order to do some kind of validation before storing 
a configuration somewhere, that's then used later to create a 
producer/consumer. If so, they might be omitting the (de)serializer properties 
(or rather, just using null as a placeholder) if the (de)serializer isn't known 
at that time and they plan on using the constructor that accepts 
already-instantiated Serializer/Deserializer instances.



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