aliehsaeedii commented on code in PR #21419:
URL: https://github.com/apache/kafka/pull/21419#discussion_r2774725347
##########
streams/src/main/java/org/apache/kafka/streams/state/internals/HeadersSerializer.java:
##########
@@ -50,17 +53,25 @@ public class HeadersSerializer implements
Serializer<Headers> {
* <p>
* The output format is [count][header1][header2]... without a size prefix.
* The size prefix is added by the outer serializer that uses this.
+ * <p>
+ * For null or empty headers, returns an empty byte array (0 bytes)
+ * instead of encoding headerCount=0 (1 byte).
*
* @param topic topic associated with data
* @param headers the headers to serialize (can be null)
- * @return the serialized byte array
+ * @return the serialized byte array (empty array if headers are null or
empty)
*/
@Override
public byte[] serialize(final String topic, final Headers headers) {
+ final Header[] headerArray = (headers == null) ? new Header[0] :
headers.toArray();
Review Comment:
var name `headersArray`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]