RFR: 8359808: JavaRuntimeURLConnection should only connect to non-directory resources [v3]
David Beaumont
duke at openjdk.org
Mon Jun 23 11:03:32 UTC 2025
On Sat, 21 Jun 2025 08:50:15 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> 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.
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?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25871#discussion_r2161328242
More information about the net-dev
mailing list