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

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

     [ https://issues.apache.org/jira/browse/KAFKA-21236?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chang Chi Hsu reassigned KAFKA-21236:
-------------------------------------

    Assignee: Chang Chi Hsu  (was: Chia-Ping Tsai)

> 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: Chang Chi Hsu
>            Priority: Minor
>
>     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)