AndrewJSchofield commented on code in PR #18162:
URL: https://github.com/apache/kafka/pull/18162#discussion_r1887168103
##########
clients/src/main/java/org/apache/kafka/common/utils/Utils.java:
##########
@@ -888,9 +892,12 @@ public FileVisitResult postVisitDirectory(Path path,
IOException exc) throws IOE
}
/**
- * Returns an empty collection if this list is null
- * @param other
- * @return
+ * Returns an empty list if the provided list is null, otherwise returns
the list itself.
+ * <p>
+ * This method is useful for avoiding `NullPointerException` when working
with potentially null lists.
Review Comment:
I'd prefer `{@code NullPointerException}`.
##########
clients/src/main/java/org/apache/kafka/common/utils/Utils.java:
##########
@@ -572,9 +572,13 @@ public static String formatAddress(String host, Integer
port) {
}
/**
- * Formats a byte number as a human-readable String ("3.2 MB")
- * @param bytes some size in bytes
- * @return
+ * Formats a byte value into a human-readable string with an appropriate
unit
+ * (e.g., "3.2 KB", "1.5 MB", "2.1 GB"). The format includes two decimal
places.
+ *
+ * @param bytes the size in bytes
+ * @return a string representing the size with the appropriate unit (e.g.,
"3.2 KB", "1.5 MB").
+ * If the value is negative, the input is returned as a string
(e.g., "-500").
+ * If the number is too large for the predefined units, the raw
byte value is returned.
Review Comment:
The "raw byte value is returned" is a bit misleading I think. I suggest "the
input is returned as a string", which is just the same as for a negative value.
--
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]