jeffkbkim commented on code in PR #15280: URL: https://github.com/apache/kafka/pull/15280#discussion_r1498526867
########## clients/src/main/java/org/apache/kafka/common/utils/Utils.java: ########## @@ -1675,6 +1677,20 @@ public static <V> Map<String, V> entriesWithPrefix(Map<String, V> map, String pr return result; } + /** + * Sanitize the string by limiting the max length and trim the spaces (i.e. \s\r\n\t) + * @param str the original string + * @param len the max length of the string + * @return sanitized string + */ + public static String sanitizeString(String str, int len) { Review Comment: i'm wondering whether we can have ``` public static String sanitizeString(String str) { return sanitizeString(str, USERNAME_MAX_LEN); } ``` and use this instead of passing USERNAME_MAX_LEN across all invocations -- 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