RFR: 8359808: JavaRuntimeURLConnection should only connect to non-directory resources [v3]
Alan Bateman
alanb at openjdk.org
Sat Jun 21 08:54:33 UTC 2025
On Fri, 20 Jun 2025 16:24:43 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
>> David Beaumont has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Feedback changes and renaming field to match nomenclature of JEP 220.
>
> 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.
> src/java.base/share/classes/sun/net/www/protocol/jrt/JavaRuntimeURLConnection.java line 133:
>
>> 131: return ParseUtil.decode(path);
>> 132: } catch (IllegalArgumentException e) {
>> 133: throw new MalformedURLException(e.getMessage());
>
> The old code treated this as fatal, throwing InternalError.
MalformedURLException seems better here.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25871#discussion_r2159981566
PR Review Comment: https://git.openjdk.org/jdk/pull/25871#discussion_r2159981211
More information about the net-dev
mailing list