You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Gérald Quintana (Jira)" <ji...@apache.org> on 2021/05/28 15:37:00 UTC
[jira] [Updated] (KAFKA-12861) MockProducer raises NPE when no
Serializer
[ https://issues.apache.org/jira/browse/KAFKA-12861?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gérald Quintana updated KAFKA-12861:
------------------------------------
Description:
Since KAFKA-10503, the MockProducer may raise NullPointerException when key/value serializers are not set:
{noformat}
java.lang.NullPointerException: null
at org.apache.kafka.clients.producer.MockProducer.send(MockProducer.java:307){noformat}
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.
was:
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.
> 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.0, 2.8.0, 2.7.1
> Reporter: Gérald Quintana
> Priority: Minor
>
> Since KAFKA-10503, the MockProducer may raise NullPointerException when key/value serializers are not set:
> {noformat}
> java.lang.NullPointerException: null
> at org.apache.kafka.clients.producer.MockProducer.send(MockProducer.java:307){noformat}
> 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)