On Sat, 11 Jan 2025 07:10:53 GMT, He-Pin(kerr) <[email protected]> wrote:
> Motivation:
> When a user passes a wrong parameter, the current implementation throws an
> IllegalArgumentException with an error message `null`, which is not helpful.
>
> Modification:
> Add detail error messages.
>
> Result:
> Helpful messages.
src/java.base/share/classes/java/util/concurrent/ThreadPoolExecutor.java line
1264:
> 1262: throw new IllegalArgumentException("maximumPoolSize must be
> positive, but got " + maximumPoolSize);
> 1263: } else if (maximumPoolSize < corePoolSize) {
> 1264: throw new IllegalArgumentException("maximumPoolSize must >=
> corePoolSize , " + "but got maximumPoolSize:" + maximumPoolSize + "
> corePoolSize :" + corePoolSize);
Too many different formulations of messages for me ("can't" vs "must be" vs
"must >=")
I'd recommend using "must be" as in "must be non-negative", "must be positive",
"must be greater-or-equal to"
test/jdk/java/util/concurrent/tck/ThreadPoolExecutorTest.java line 309:
> 307: shouldThrow();
> 308: } catch (NullPointerException success) {
> 309: Assert.assertNotNull(success.getMessage());
Should assert the expected message.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23050#discussion_r1952735674
PR Review Comment: https://git.openjdk.org/jdk/pull/23050#discussion_r1952737822