You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2021/10/26 21:23:23 UTC

[GitHub] [kafka] cmccabe commented on a change in pull request #10830: KAFKA-12902: Add unit32 type in generator

cmccabe commented on a change in pull request #10830:
URL: https://github.com/apache/kafka/pull/10830#discussion_r736932247



##########
File path: clients/src/main/java/org/apache/kafka/common/protocol/MessageUtil.java
##########
@@ -94,6 +94,15 @@ public static int jsonNodeToUnsignedShort(JsonNode node, String about) {
         return value;
     }
 
+    public static long jsonNodeToUnsignedInt(JsonNode node, String about) {
+        long value = jsonNodeToLong(node, about);
+        if (value < 0 || value > 4294967293L) {

Review comment:
       This constant value doesn't seem quite right. (2**32) - 1 = 4294967295, not 4294967293.
   
   It would be good to create a `final static` constant for this as well as for the `65535` below. Something like UNSIGNED_INT_MAX / UNSIGNED_SHORT_MAX ?




-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org