src/share/classes/org/openjdk/jigsaw/SimpleLibrary.java

Print this page

        

@@ -1008,12 +1008,13 @@
                     if (f.getPath().endsWith(".class"))
                         addToIndex(ClassInfo.read(f), ix);
                 }
             });
         } else if (cd.isFile()) {
-            FileInputStream fis = new FileInputStream(cd);
-            ZipInputStream zis = new ZipInputStream(fis);
+            try (FileInputStream fis = new FileInputStream(cd);
+                 ZipInputStream zis = new ZipInputStream(fis))
+            {
             ZipEntry ze;
             while ((ze = zis.getNextEntry()) != null) {
                 if (!ze.getName().endsWith(".class"))
                     continue;
                 addToIndex(ClassInfo.read(Files.nonClosingStream(zis),

@@ -1020,10 +1021,11 @@
                                           ze.getSize(),
                                           mid + ":" + ze.getName()),
                            ix);
             }
         }
+        }
 
         ix.store();
     }
 
     /**