mjsax commented on code in PR #22514:
URL: https://github.com/apache/kafka/pull/22514#discussion_r3382797961


##########
clients/src/main/java/org/apache/kafka/common/serialization/ListDeserializer.java:
##########
@@ -220,14 +220,18 @@ private int readEntrySize(
         final SerializationStrategy serStrategy,
         final int length
     ) throws IOException {
-        final int entrySize = serStrategy == 
SerializationStrategy.CONSTANT_SIZE ? primitiveSize : dis.readInt();
-        if (entrySize < -1) { // value `-1` is valid, encoding a null entry 
(-> ListSerde.NULL_ENTRY_VALUE)
-            throw new SerializationException("Corrupted byte[]. A list entry 
cannot have negative size.");
-        }
-        if (entrySize > length) {
-            throw new SerializationException("Corrupted byte[]. A list entry 
cannot be larger than the overall number of bytes.");
+        if (serStrategy == SerializationStrategy.CONSTANT_SIZE) {

Review Comment:
   It mostly refactor, yes, but we also don't need to check the size for the 
"constant_size" change, so it's overall cleaner code.



-- 
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]

Reply via email to