You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Chia-Ping Tsai (Jira)" <ji...@apache.org> on 2026/10/07 06:41:00 UTC

[jira] [Created] (KAFKA-21236) DefaultMessageFormatter should not pass the null literal to deserializers for null key/value

Chia-Ping Tsai created KAFKA-21236:
--------------------------------------

             Summary: DefaultMessageFormatter should not pass the null literal to deserializers for null key/value
                 Key: KAFKA-21236
                 URL: https://issues.apache.org/jira/browse/KAFKA-21236
             Project: Kafka
          Issue Type: Bug
            Reporter: Chia-Ping Tsai
            Assignee: Chia-Ping Tsai


    private byte[] deserialize(ConsumerRecord<byte[], byte[]> consumerRecord, Optional<Deserializer<?>> deserializer, byte[] sourceBytes, String topic) {
        byte[] nonNullBytes = sourceBytes != null ? sourceBytes : nullLiteral;
        return deserializer.map(value -> utfBytes(value.deserialize(topic, consumerRecord.headers(), nonNullBytes).toString())).orElse(nonNullBytes);
    }

It looks like only the official StringDeserializer is safe from this logic. I guess we should just skip the deserializer and return nullLiteral instead.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)