RFR: 8359808: JavaRuntimeURLConnection should only connect to non-directory resources [v3]
Roger Riggs
rriggs at openjdk.org
Mon Jun 23 14:36:33 UTC 2025
On Mon, 23 Jun 2025 10:55:57 GMT, David Beaumont <duke at openjdk.org> wrote:
>> 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).
Drop it until there's a reason for it. tnx.
>> MalformedURLException seems better here.
>
> Yes, but is that good though? This is a public API and surely as a random user I shouldn't be able to trigger an `Error` just by having bad input data?
> Since we can reasonably reason that, to a first approximation, "this code path isn't being hit by anyone" it felt reasonable to reflect "bad input data" with a MalformedURLException.
> Shall I change it back?
MalformedURLException is fine.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25871#discussion_r2161786366
PR Review Comment: https://git.openjdk.org/jdk/pull/25871#discussion_r2161786871
More information about the net-dev
mailing list