RFR: 8374368: Invalid java.nio.channels.spi.SelectorProvider value results in ClassNotFoundException instead of falling back to default provider

Leonid Mesnik lmesnik at openjdk.org
Sun Dec 28 03:01:01 UTC 2025


On Fri, 26 Dec 2025 05:27:53 GMT, Shruthi Acharya <sacharya at openjdk.org> wrote:

> Fall back to the default SelectorProvider by logging an error when an invalid provider is specified via the java.nio.channels.spi.SelectorProvider system property.
> The bug report for the same: https://bugs.openjdk.org/browse/JDK-8374368

Changes requested by lmesnik (Reviewer).

src/java.base/share/classes/java/nio/channels/spi/SelectorProvider.java line 98:

> 96:                 Class<?> clazz = Class.forName(cn, true, ClassLoader.getSystemClassLoader());
> 97:                 return (SelectorProvider) clazz.getConstructor().newInstance();
> 98:             } catch (Throwable t) {

This fix should have a regression test, based on the provided reproducer.
If it can't be implemented, then bug should have 'noreg-' label.

-------------

PR Review: https://git.openjdk.org/jdk/pull/28998#pullrequestreview-3614498838
PR Review Comment: https://git.openjdk.org/jdk/pull/28998#discussion_r2649442749


More information about the nio-dev mailing list