On Mon, 22 May 2023 16:04:10 GMT, Jesse Glick <d...@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