On Thu, 26 Feb 2026 15:40:59 GMT, Chen Liang <[email protected]> wrote:

> Old code ensured getInflater can fail properly when inflaterCache is null. 
> This safety is lost in your refactor.

getInflater is only called from ZipFile::getInputStream which always holds a 
lock on the ZipFile instance while calling getInflater.

CleanableResource::run can either be run from a Cleaner, in which case nothing 
references the ZipFile and thus cannot call getInflater. Or it can be run via 
ZipFile::close, which always holds a lock on the ZipFile instance.

getInputStream will never call getInflater in the case where the inflaterCache 
is null, since ensureOpen and CleanableResource:run are run holding the same 
lock.

Even if it could, "fail properly" is a stretch. It would fail with an 
undocumented NPE, right?

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

PR Comment: https://git.openjdk.org/jdk/pull/29937#issuecomment-3967528684

Reply via email to