RFR: 8344078: Remove security manager dependency in java.nio [v3]

Glavo duke at openjdk.org
Sat Nov 16 06:17:49 UTC 2024


On Sat, 16 Nov 2024 00:33:13 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Expunge the use of the `SecurityManager`, `AccessController`, and the like from the `java.nio` and `sun.nio` package hierarchies.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8344078: Address reviewer comments

src/java.base/share/classes/java/nio/charset/Charset.java line 416:

> 414:         try {
> 415:             for (Iterator<CharsetProvider> i = providers();
> 416:                  i.hasNext();) {

Suggestion:

            for (Iterator<CharsetProvider> i = providers(); i.hasNext();) {


No more line breaks are needed here.

src/java.base/share/classes/sun/nio/ch/AsynchronousChannelGroupImpl.java line 48:

> 46:     // thread pool. Internal threads do not dispatch to completion handlers.
> 47:     private static final int internalThreadCount =
> 48:         Integer.valueOf(System.getProperty("sun.nio.ch.internalThreadPoolSize", "1"));

Suggestion:

        Integer.getInteger("sun.nio.ch.internalThreadPoolSize", 1);

src/java.base/share/classes/sun/nio/ch/Invoker.java line 43:

> 41:     // avoid stack overflow and lessens the risk of starvation.
> 42:     private static final int maxHandlerInvokeCount =
> 43:         Integer.valueOf(System.getProperty("sun.nio.ch.maxCompletionHandlersOnStack", "16"));

Suggestion:

        Integer.getInteger("sun.nio.ch.maxCompletionHandlersOnStack", 16);


The behavior here changes when the value cannot be parsed as an integer.

`GetIntegerAction` uses `Integer.getInteger` to get the value. When the value cannot be parsed as an integer, it returns the default value instead of throwing `NumberFormatException`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22132#discussion_r1844917157
PR Review Comment: https://git.openjdk.org/jdk/pull/22132#discussion_r1844918982
PR Review Comment: https://git.openjdk.org/jdk/pull/22132#discussion_r1844918157


More information about the nio-dev mailing list