RFR: JDK-6956385: URLConnection.getLastModified() leaks file handles for jar:file and file: URLs [v3]

Bernd duke at openjdk.org
Mon May 22 16:19:41 UTC 2023


On Mon, 22 May 2023 16:04:10 GMT, Jesse Glick <duke at openjdk.org> wrote:

>> src/java.base/share/classes/sun/net/www/protocol/jar/JarURLConnection.java line 97:
>> 
>>> 95:                     }
>>> 96:                 } finally {
>>> 97:                     if (jarFileURLConnection instanceof FileURLConnection fileURLConnection) {
>> 
>> I Wonder if closing all urlconnection types or the ones with a special interface instead of a specific type (which also introduces a dependency) would be the better way? what about other connections with even more temporary resources (like a temporary file copy?)
>
> See discussion at https://github.com/openjdk/jdk/pull/12871#discussion_r1198932229.

It does not address the question if it needs to close more than the file: protocol.

(And it still feels like a layering violation, should maybe the metadata function initializeHeaders close its own stream - balanced with connect())?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/12871#discussion_r1200732253


More information about the net-dev mailing list