RFR: 8347491: IllegalArgumentationException thrown by ThreadPoolExecutor doesn't have a useful message [v2]
Viktor Klang
vklang at openjdk.org
Wed Feb 26 13:40:11 UTC 2025
On Mon, 24 Feb 2025 16:21:33 GMT, He-Pin(kerr) <duke at openjdk.org> 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.
>
> He-Pin(kerr) has updated the pull request incrementally with one additional commit since the last revision:
>
> chore: update tests
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 be greater than or equal to corePoolSize , " + "but got maximumPoolSize:" + maximumPoolSize + " ,corePoolSize:" + corePoolSize);
Suggestion:
throw new IllegalArgumentException("maximumPoolSize must be greater than or equal to corePoolSize , " + "but got maximumPoolSize: " + maximumPoolSize + " , and corePoolSize: " + corePoolSize);
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23050#discussion_r1971601932
More information about the core-libs-dev
mailing list