RFR JDK-8185582, Update Zip implementation to use Cleaner, not finalizers

Florian Weimer fw at deneb.enyo.de
Sat Oct 28 14:16:50 UTC 2017

* Xueming Shen:

> I removed the ln#657-#663, and updated the @apiNote in deflter, inflater
> and zipfile accordingly, mainly combined your comment and the approach
> for the fis/fo. they are "simpler" and straightforward now, at least for me.
> https://bugs.openjdk.java.net/browse/JDK-8187485
> http://cr.openjdk.java.net/~sherman/8185582/webrev

In ZipFile:

387                 Inflater inf = getInflater();
388                 InputStream is = new ZipFileInflaterInputStream(in, inf, (int)size,
389                                          () -> releaseInflater(inf));
390                 synchronized (streams) {
391                     streams.add(is);
392                 }

Doesn't this leak the inflater if Cleaner.register() and thus the
ZipFileInflaterInputStream constructor throw?

More information about the core-libs-dev mailing list