RFR: 8294626: Improve URL protocol lower casing [v3]

Claes Redestad redestad at openjdk.org
Fri Sep 30 13:22:21 UTC 2022


On Fri, 30 Sep 2022 12:36:10 GMT, Сергей Цыпанов <duke at openjdk.org> wrote:

>> Claes Redestad has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Cleanups
>>  - Revert accidental import mangling
>
> src/java.base/share/classes/java/net/URL.java line 1388:
> 
>> 1386:      */
>> 1387:     static String lowerCaseProtocol(String protocol) {
>> 1388:         if (protocol.equals("jrt")) {
> 
> I don't get the difference between chaining with `||` and `if-else if`?

There'd be no point in changing from a `||`-chain to `if.. else if` unless there's also a need to have different results happen from either case. Here we now want to return the appropriate constant (`"jrt"` etc), thus splitting the `||` is necessary.

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

PR: https://git.openjdk.org/jdk/pull/10506


More information about the net-dev mailing list