RFR: 8268873: Unnecessary Vector usage in java.base

Andrey Turbanov github.com+741251+turbanoff at openjdk.java.net
Wed Jun 16 09:52:38 UTC 2021


On Wed, 16 Jun 2021 09:01:30 GMT, Сергей Цыпанов <github.com+10835776+stsypanov at openjdk.org> wrote:

>> Usage of thread-safe collection `Vector` is unnecessary. It's recommended to use `ArrayList` if a thread-safe implementation is not needed.
>> I checked only places where `Vector` was used as local variable.
>
> src/java.base/share/classes/sun/net/www/protocol/https/HttpsClient.java line 154:
> 
>> 152:             while (tokenizer.hasMoreTokens())
>> 153:                 v.add(tokenizer.nextToken());
>> 154:             ciphers = new String [v.size()];
> 
> Looks like this whole `else` block can be simplified to `ciphers = cipherString.split(",");`

It's not a drop-in replacement. Result is different for some Strings. For example for `,  A`
I would prefer to preserve existing behavior under this cleanup.

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

PR: https://git.openjdk.java.net/jdk/pull/4482



More information about the security-dev mailing list