RFC: 8132359: JarURLConnection.getJarFile() resource leak when file is not found

Alex Kashchenko akashche at redhat.com
Fri May 8 14:35:22 UTC 2020


On 05/06/2020 01:11 PM, Michael McMahon wrote:
> Hi,
> 
> Yes, we've had some discussion about it internally, and while others may
> yet have an opinion, I think this approach is a reasonable one, with a 
> spec change
> that captures the behavior.
> 
> The main thing we need to capture is that while connect() to a non 
> existing resource
> may fail, getJarFile() can still return a reference to the containing 
> JAR file if that is accessible.
> 
> There could be other subtleties like what happens if the JAR file is not 
> accessible,
> is null a reasonable return value in that case? I think that could 
> happen and might
> need to be specified.

I've created a CSR for this issue listing the "return null" variant 
above and "disable cache" as alternatives:

https://bugs.openjdk.java.net/browse/JDK-8244650

The wording for getJarFile() specification currently doesn't specify 
what happens, when entry doesn't exist. If it is better to change this 
wording - I would appreciate a guidance on that.

> 
> [...]
> 

-- 
-Alex



More information about the net-dev mailing list