RFR: 8359808: JavaRuntimeURLConnection should only connect to non-directory resources [v3]

Roger Riggs rriggs at openjdk.org
Fri Jun 20 16:37:32 UTC 2025


On Wed, 18 Jun 2025 13:00:54 GMT, David Beaumont <duke 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 119:
> 
>> 117:     public long getContentLengthLong() {
>> 118:         try {
>> 119:             return getResourceNode().size();
> 
> Having getResourceNode() return the (lazily fetched) node avoids the reader needing to know/reason about how "connect()" has the side-effect of making the "resource" field non-null.

It looks like ExplodedImage.PathNode.size() throws UncheckedIOException. That might need mapping back to IOException to get the -1 return consistently.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/25871#discussion_r2159332017


More information about the net-dev mailing list