You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/05/03 23:31:02 UTC

[GitHub] [kafka] RivenSun2 commented on a diff in pull request #12010: KAFKA-13793: Add validators for configs that lack validators

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`. `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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org