RFR: 8175874: Update Security.insertProviderAt to specify behavior when requested position is out of range. [v4]

Sean Mullan mullan at openjdk.org
Thu Aug 17 21:41:30 UTC 2023


On Thu, 17 Aug 2023 18:33:09 GMT, Ben Perez <duke at openjdk.org> wrote:

>> Fixing the bug as stated would cause compatibility issues. E.g. the `addProvider` function always adds new providers at position 0 and therefore would always throw an error. Instead of changing how the function handles indices, we instead have added this behavior to the function spec.
>
> Ben Perez has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Changed function spec wording, updated test

Changes requested by mullan (Reviewer).

src/java.base/share/classes/java/security/Security.java line 302:

> 300:      * is less than 1 or greater than n, where n is the number of installed
> 301:      * providers, the provider (if not already installed) is inserted at
> 302:      * the end ofthe list, or at the n + 1 position.

Missing space between "of" and "the".

test/jdk/java/security/Provider/ChangeProviders.java line 1:

> 1: /*

Add bugid to the `@bug` line.

test/jdk/java/security/Provider/ChangeProviders.java line 85:

> 83: 
> 84:         //Ensure that providers inserted at position 0 or > n are placed
> 85:         //at the n+1st position

Nit: typically there is a space after `//`.

test/jdk/java/security/Provider/ChangeProviders.java line 90:

> 88:         }
> 89:         Provider r = new NextProvider();
> 90:         Security.insertProviderAt(r,0);

Nit: add space after `,`.

test/jdk/java/security/Provider/ChangeProviders.java line 91:

> 89:         Provider r = new NextProvider();
> 90:         Security.insertProviderAt(r,0);
> 91:         if (plen() != n+2 || Security.getProviders()[n+1] != r) {

Nit: add space before/after `+`.

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

PR Review: https://git.openjdk.org/jdk/pull/14925#pullrequestreview-1583524000
PR Review Comment: https://git.openjdk.org/jdk/pull/14925#discussion_r1297771334
PR Review Comment: https://git.openjdk.org/jdk/pull/14925#discussion_r1297771869
PR Review Comment: https://git.openjdk.org/jdk/pull/14925#discussion_r1297772324
PR Review Comment: https://git.openjdk.org/jdk/pull/14925#discussion_r1297772916
PR Review Comment: https://git.openjdk.org/jdk/pull/14925#discussion_r1297773312



More information about the security-dev mailing list