RocMarshal commented on code in PR #30107:
URL: https://github.com/apache/flink/pull/30107#discussion_r4709625083


##########
flink-core-api/src/main/java/org/apache/flink/configuration/MemorySize.java:
##########
@@ -79,7 +79,18 @@ public MemorySize(long bytes) {
         this.bytes = bytes;
     }
 
+    /**
+     * Creates a memory size from a count of mebibytes.
+     *
+     * @param mebiBytes the number of mebibytes
+     * @return the corresponding memory size
+     * @throws IllegalArgumentException if the count is negative or its byte 
count exceeds {@link
+     *     Long#MAX_VALUE}
+     */
     public static MemorySize ofMebiBytes(long mebiBytes) {
+        if (mebiBytes < 0 || mebiBytes > (Long.MAX_VALUE >> 20)) {
+            throw new IllegalArgumentException("Mebibytes out of range: " + 
mebiBytes);

Review Comment:
   ```suggestion
               throw new IllegalArgumentException("Value in mebibytes is out of 
range: " + mebiBytes);
   ```



-- 
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]

Reply via email to