This is an automated email from the ASF dual-hosted git repository.

mjsax pushed a commit to branch 4.2
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/4.2 by this push:
     new f1ce66265a8 MINOR: improve ListDeserializer exception (#22546)
f1ce66265a8 is described below

commit f1ce66265a85486d2fac621c32883485d4d6cad8
Author: Matthias J. Sax <[email protected]>
AuthorDate: Fri Jun 12 17:42:31 2026 -0700

    MINOR: improve ListDeserializer exception (#22546)
    
    We would currently get a NPE trying to use `primitiveSize`. This PR adds
    a check to throw a SerializationException instead.
    
    Reviewers: nileshkumar3 <[email protected]>, Lucas Brutschy
     <[email protected]>, Chia-Ping Tsai <[email protected]>
---
 .../java/org/apache/kafka/common/serialization/ListDeserializer.java  | 3 +++
 .../src/main/java/org/apache/kafka/streams/test/TestRecord.java       | 4 ++++
 2 files changed, 7 insertions(+)

diff --git 
a/clients/src/main/java/org/apache/kafka/common/serialization/ListDeserializer.java
 
b/clients/src/main/java/org/apache/kafka/common/serialization/ListDeserializer.java
index 402f4945a8e..da6ac3feff2 100644
--- 
a/clients/src/main/java/org/apache/kafka/common/serialization/ListDeserializer.java
+++ 
b/clients/src/main/java/org/apache/kafka/common/serialization/ListDeserializer.java
@@ -173,6 +173,9 @@ public class ListDeserializer<Inner> implements 
Deserializer<List<Inner>> {
             SerializationStrategy serStrategy = 
parseSerializationStrategyFlag(dis.readByte());
             List<Integer> nullIndexList = null;
             if (serStrategy == SerializationStrategy.CONSTANT_SIZE) {
+                if (primitiveSize == null) {
+                    throw new SerializationException("Data is encoded as 
constant size entries, but configured inner deserializer is not a known 
fixed-size deserializer.");
+                }
                 // In CONSTANT_SIZE strategy, indexes of null entries are 
decoded from a null index list
                 nullIndexList = deserializeNullIndexList(dis, data.length);
             }
diff --git 
a/streams/test-utils/src/main/java/org/apache/kafka/streams/test/TestRecord.java
 
b/streams/test-utils/src/main/java/org/apache/kafka/streams/test/TestRecord.java
index 63f692106ee..eb724a08e16 100644
--- 
a/streams/test-utils/src/main/java/org/apache/kafka/streams/test/TestRecord.java
+++ 
b/streams/test-utils/src/main/java/org/apache/kafka/streams/test/TestRecord.java
@@ -38,6 +38,10 @@ public class TestRecord<K, V> {
     private final V value;
     private final Instant recordTime;
 
+    public boolean equalsIgnorePartition(final TestRecord<? extends K, ? super 
V> o) {
+        return false;
+    }
+
     /**
      * Creates a record.
      *

Reply via email to