kafka-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gérald Quintana (Jira) <j...@apache.org>
Subject [jira] [Created] (KAFKA-12861) MockProducer raises NPE when no Serializer
Date Fri, 28 May 2021 15:37:00 GMT
Gérald Quintana created KAFKA-12861:
---------------------------------------

             Summary: MockProducer raises NPE when no Serializer
                 Key: KAFKA-12861
                 URL: https://issues.apache.org/jira/browse/KAFKA-12861
             Project: Kafka
          Issue Type: Bug
          Components: clients
    Affects Versions: 2.7.1, 2.8.0, 2.7.0
            Reporter: Gérald Quintana


Since KAFKA-10503, the MockProducer may raise NullPointerException when key/value serializers
are not set:
*15:58:16*  java.lang.NullPointerException: null*15:58:16*  	at org.apache.kafka.clients.producer.MockProducer.send(MockProducer.java:307)
This occurs when using MockProducer default constructor:
{code:java}
public MockProducer() {
 this(Cluster.empty(), false, null, null, null);
}{code}
The problem didn't occur on Kafka Client 2.6.

I understand this constructor is only for metadata as described in JavaDoc. However defaulting
to a Noop serializer (MockSerializer) would be a better default. Removing the default constructor
to force declaring a serialiszer could also be a solution.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Mime
View raw message