RFR: JDK-6956385: URLConnection.getLastModified() leaks file handles for jar:file and file: URLs [v2]
Daniel Fuchs
dfuchs at openjdk.org
Fri May 19 15:19:03 UTC 2023
On Fri, 19 May 2023 15:07:37 GMT, Jesse Glick <duke at openjdk.org> wrote:
>> Yes.
>>
>> Also I noticed that we cannot define `void close() throws IOException` here either, because of https://github.com/openjdk/jdk/blob/44218b1c9e5daa33557aac9336251cf8398d81eb/src/java.base/share/classes/sun/net/www/URLConnection.java#L256-L262 so for now I will go with another method name.
>
> Curiously, this method appears to never be called; at least
>
>
> diff --git src/java.base/share/classes/sun/net/www/URLConnection.java src/java.base/share/classes/sun/net/www/URLConnection.java
> index b3af24c594b..f346cd8869b 100644
> --- src/java.base/share/classes/sun/net/www/URLConnection.java
> +++ src/java.base/share/classes/sun/net/www/URLConnection.java
> @@ -253,14 +253,6 @@ public abstract class URLConnection extends java.net.URLConnection {
> REMIND */ ;
> }
>
> - /**
> - * Call this to close the connection and flush any remaining data.
> - * Overriders must remember to call super.close()
> - */
> - public void close() {
> - url = null;
> - }
> -
> private static HashMap<String,Void> proxiedHosts = new HashMap<>();
>
> public static synchronized void setProxiedHost(String host) {
>
>
> does not cause
>
>
> make images
>
>
> to fail, though it seems that the JDK source base does not currently enforce use of `@Override`. (I did not find any overrides from a text search, and if there were some without the annotation, they were apparently not calling `super.close()`.)
Interesting. If it's not called anywhere maybe we could investigate adding `throws IOException` to the signature...
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/12871#discussion_r1199080504
More information about the net-dev
mailing list