dajac commented on code in PR #22264:
URL: https://github.com/apache/kafka/pull/22264#discussion_r3254383344


##########
generator/src/main/java/org/apache/kafka/message/MessageDataGenerator.java:
##########
@@ -624,15 +624,19 @@ private void generateVariableLengthReader(Versions 
fieldFlexibleVersions,
         buffer.printf("if (%s < 0) {%n", lengthVar);
         buffer.incrementIndent();
         VersionConditional.forVersions(nullableVersions, possibleVersions).
-            ifNotMember(__ -> buffer.printf("throw new 
RuntimeException(\"non-nullable field %s " +
-                "was serialized as null\");%n", name)).
+            ifNotMember(__ -> {
+                
headerGenerator.addImport(MessageGenerator.SCHEMA_EXCEPTION_CLASS);
+                buffer.printf("throw new SchemaException(\"non-nullable field 
%s " +

Review Comment:
   Hum... I am not convinced that throwing `SchemaException` here is the right 
approach. Should we keep this path focused on catching all the existing 
exceptions in  `ConsumerProtocol`? This seems sufficient to fix the bug. 



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