RFR: 8359808: JavaRuntimeURLConnection should only connect to non-directory resources
Alan Bateman
alanb at openjdk.org
Wed Jun 18 13:41:29 UTC 2025
On Wed, 18 Jun 2025 13:21:45 GMT, David Beaumont <duke at openjdk.org> wrote:
>> src/java.base/share/classes/sun/net/www/protocol/jrt/JavaRuntimeURLConnection.java line 56:
>>
>>> 54: // about percent encoding. However, we choose to treat the module name is if
>>> 55: // it were a URL authority (since Java package/module names are historically
>>> 56: // strongly associated with internet domain names).
>>
>> "However, we choose to treat the module name is if URL authority" - I don't think we should be put in the comment as it is confusing to suggest the URL authority component. The URL scheme documented in JEP 220 always put the module and resource name in the URL path component. It's just historical that it allowed for encoding of the resource name, wasn't given enough thought in JDK 9 when this url stream handler was added.
>
> Happy to accept rewording here. I do want to pull out that there *is* a conceptual reason for treating module names like domain authorities though, or just make the code treat the whole path the same.
> Having unexplained weirdness like this just ends up being a drain on future maintainers otherwise.
> Happy to accept rewording here. I do want to pull out that there _is_ a conceptual reason for treating module names like domain authorities though, or just make the code treat the whole path the same. Having unexplained weirdness like this just ends up being a drain on future maintainers otherwise.
I don't disagree on the weirdness but I don't want to mislead readers that this has anything to do with the URL authority component (the jrt scheme does not have this component). However to explain the weirdness requires digging into history, probably the jake repo where the changes for JEP 220 were accumulated before the JEP was integrated.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25871#discussion_r2154637860
More information about the net-dev
mailing list