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)

Reply via email to