Setting "jmx.remote.x.notification.buffer.size" to Integer.MAX_VALUE causes a NegativeArraySizeException, as the value has 1 added before making a new array. An Exception should be thrown, but an expected, checked Exception.
The EnvHelp method getNotifBufferSize(env) should throw IllegalArgumentException if we are near the limit. This should apply whether value is set from the System Property or env setting. In the affected method in EnvHelp.java I've made some whitespace adjustments, the key change is the check at the new line 290. --------- - [x] I confirm that I make this contribution in accordance with the [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). ------------- Commit messages: - 8392788: JMX notification buffer size Integer.MAX_VALUE causes NegativeArraySizeException Changes: https://git.openjdk.org/jdk/pull/33010/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=33010&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8392788 Stats: 52 lines in 2 files changed: 40 ins; 3 del; 9 mod Patch: https://git.openjdk.org/jdk/pull/33010.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/33010/head:pull/33010 PR: https://git.openjdk.org/jdk/pull/33010
