@@ -464,7 +464,7 @@ static void listFilesImpl(File folder, boolean relative,
464464
465465 /**
466466 * @param folder source folder to search
467- * @return a list of .jar and .zip files in that folder
467+ * @return an array of .jar and .zip files in that folder
468468 */
469469 static public File [] listJarFiles (File folder ) {
470470 return folder .listFiles ((dir , name ) ->
@@ -585,9 +585,9 @@ static private void packageListFromZip(String filename, StringList list) {
585585 if (!entry .isDirectory ()) {
586586 String name = entry .getName ();
587587
588- // Avoid META-INF because some jokers but .class files in there
588+ // Avoid META-INF because some jokers put .class files in there
589589 // https://github.com/processing/processing/issues/5778
590- if (name .endsWith (".class" ) && !name .startsWith ("META-INF/" )) {
590+ if (name .endsWith (".class" ) && !name .contains ("META-INF/" )) {
591591 int slash = name .lastIndexOf ('/' );
592592 if (slash != -1 ) {
593593 String packageName = name .substring (0 , slash );
@@ -640,31 +640,27 @@ static private void packageListFromFolder(File dir, String sofar,
640640 * Extract the contents of a .zip archive into a folder.
641641 * Ignores (does not extract) any __MACOSX files from macOS archives.
642642 */
643- static public void unzip (File zipFile , File dest ) {
644- try {
645- FileInputStream fis = new FileInputStream (zipFile );
646- CheckedInputStream checksum = new CheckedInputStream (fis , new Adler32 ());
647- ZipInputStream zis = new ZipInputStream (new BufferedInputStream (checksum ));
648- ZipEntry entry ;
649- while ((entry = zis .getNextEntry ()) != null ) {
650- final String name = entry .getName ();
651- if (!name .startsWith (("__MACOSX" ))) {
652- File currentFile = new File (dest , name );
653- if (entry .isDirectory ()) {
654- currentFile .mkdirs ();
655- } else {
656- File parentDir = currentFile .getParentFile ();
657- // Sometimes the directory entries aren't already created
658- if (!parentDir .exists ()) {
659- parentDir .mkdirs ();
660- }
661- currentFile .createNewFile ();
662- unzipEntry (zis , currentFile );
643+ static public void unzip (File zipFile , File dest ) throws IOException {
644+ FileInputStream fis = new FileInputStream (zipFile );
645+ CheckedInputStream checksum = new CheckedInputStream (fis , new Adler32 ());
646+ ZipInputStream zis = new ZipInputStream (new BufferedInputStream (checksum ));
647+ ZipEntry entry ;
648+ while ((entry = zis .getNextEntry ()) != null ) {
649+ final String name = entry .getName ();
650+ if (!name .startsWith (("__MACOSX" ))) {
651+ File currentFile = new File (dest , name );
652+ if (entry .isDirectory ()) {
653+ currentFile .mkdirs ();
654+ } else {
655+ File parentDir = currentFile .getParentFile ();
656+ // Sometimes the directory entries aren't already created
657+ if (!parentDir .exists ()) {
658+ parentDir .mkdirs ();
663659 }
660+ currentFile .createNewFile ();
661+ unzipEntry (zis , currentFile );
664662 }
665663 }
666- } catch (Exception e ) {
667- e .printStackTrace ();
668664 }
669665 }
670666
0 commit comments