< prev index next >

src/java.base/share/classes/java/util/zip/ZipFile.java

Print this page
rev 48331 : 8193507: [REDO] Startup regression due to JDK-8185582
Reviewed-by: alanb, rriggs
Contributed-by: xueming.shen@oracle.com, claes.redestad@oracle.com

@@ -410,10 +410,25 @@
                 throw new ZipException("invalid compression method");
             }
         }
     }
 
+    private static class InflaterCleanupAction implements Runnable {
+        private final Inflater inf;
+        private final CleanableResource res;
+
+        InflaterCleanupAction(Inflater inf, CleanableResource res) {
+            this.inf = inf;
+            this.res = res;
+        }
+
+        @Override
+        public void run() {
+            res.releaseInflater(inf);
+        }
+    }
+
     private class ZipFileInflaterInputStream extends InflaterInputStream {
         private volatile boolean closeRequested;
         private boolean eof = false;
         private final Cleanable cleanable;
 

@@ -425,11 +440,11 @@
         private ZipFileInflaterInputStream(ZipFileInputStream zfin,
                                            CleanableResource res,
                                            Inflater inf, int size) {
             super(zfin, inf, size);
             this.cleanable = CleanerFactory.cleaner().register(this,
-                    () -> res.releaseInflater(inf));
+                    new InflaterCleanupAction(inf, res));
        }
 
         public void close() throws IOException {
             if (closeRequested)
                 return;
< prev index next >