etolbakov commented on code in PR #12388:
URL: https://github.com/apache/kafka/pull/12388#discussion_r917905764


##########
clients/src/main/java/org/apache/kafka/common/utils/Utils.java:
##########
@@ -1432,4 +1432,17 @@ public static String[] enumOptions(Class<? extends 
Enum<?>> enumClass) {
                 .toArray(String[]::new);
     }
 
+    /**
+     * Ensures that the provided {@code reason} remains within a range of 255 
chars.
+     * @param reason This is the reason that is sent to the broker over the 
wire
+     *               as a part of {@code JoinGroupRequest}, {@code 
LeaveGroupRequest} or {@code RemoveMembersFromConsumerGroupOptions} messages.
+     * @return a provided reason as is or truncated reason if it exceeds the 
255 chars threshold.
+     */
+    public static String truncateIfRequired(final String reason) {

Review Comment:
   thanks for the suggestions!
   yeah `maybeTruncateReason` for sure is a better name, also I've noticed 
there are a few method names that start with "maybe" so it will be consistent.  



-- 
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-unsubscr...@kafka.apache.org

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

Reply via email to