uros-b commented on code in PR #56655:
URL: https://github.com/apache/spark/pull/56655#discussion_r3452158021
##########
common/utils-java/src/main/java/org/apache/spark/network/util/ByteUnit.java:
##########
@@ -54,6 +54,10 @@ public long toBytes(long d) {
if (d < 0) {
throw new IllegalArgumentException("Negative size value. Size must be
positive: " + d);
}
+ if (Long.MAX_VALUE / multiplier < d) {
+ throw new IllegalArgumentException("Conversion of " + d + " " + name()
+ + " to bytes exceeds Long.MAX_VALUE");
Review Comment:
Nit: `convertTo` also gives a hint ("Try a larger unit"); could we give a
brief hint here as well?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]