Closed merlor closed 2 years ago
I think this is the same as https://github.com/Apicurio/apicurio-registry/issues/2641 and should be fixed in the next release via this PR: https://github.com/Apicurio/apicurio-registry/pull/2642
@ajborley It's exactly the same issue (my bad, I didn't see it). You can close, thank you so much for the fast response.
I'm using apicurio 2.2.5.Final with spring cloud stream kafka streams and avroSerdes, I have to read/write the artifact identifier from/to payload instead of headers so I have added this configuration to my props file:
spring.cloud.stream.kafka.streams.binder.configuration.apicurio.registry.headers.enabled=false
But after this addition every message received cause:
java.lang.NullPointerException: Cannot invoke "io.apicurio.registry.serde.headers.HeadersHandler.readHeaders(org.apache.kafka.common.header.Headers)" because "this.headersHandler" is null
The problem is in the method
deserialize(String topic, Headers headers, byte[] data)
inside the classio.apicurio.registry.serde.AbstractKafkaDeserializer
; this is the code:There is no headers in the message but the condition
(headers != null)
is true (because the variable is valorized with an empty array) and the callheadersHandler.readHeaders(headers)
withheadersHandler
null causes a NPE.Am I doing all right or there are other configurations to add?
A possible solution could be change
headers != null
intoheaders != null && headers.toArray().size() > 0
or check ifheadersHandler
is not null