On Sat, 21 Jun 2025 08:51:57 GMT, Alan Bateman <[email protected]> wrote:
>> src/java.base/share/classes/sun/net/www/protocol/jrt/JavaRuntimeURLConnection.java
>> line 128:
>>
>>> 126: if (path.indexOf('%') == -1) {
>>> 127: // Nothing to decode (overwhelmingly common case).
>>> 128: return path;
>>
>> Does this make a performance difference, checking for '%' is the first thing
>> in ParseUtil.decode.
>> It seems redundant to check here too.
>
> The jrt protocol handler only exists because a URL streams a corresponding
> URLStreamHandler. It's not clear if the protocol handler is actually used. So
> I don't expect it is performance critical.
This is here because I expect we will want to do something else in the "slow"
path where '%' is present.
I wanted to put an 'X' in the code where any additional logic around decoding
goes, and none of that needs to happen if no '%' chars exist.
For example, I think that we probably need to "worry about" %2F in the path,
since that's not a synonym for '/' according to the URI specification.
I can back this out for now if you want (please say one way of the other), but
given we never create paths with '%' in, it won't affect anything for any case
we care about (if this wasn't here then the decode call would do it anyway).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25871#discussion_r2161321416