Skip to content

Commit 5a79e32

Browse files
Add try() to manage opened files/rsrcs
1 parent 1b08eec commit 5a79e32

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

app/src/processing/app/Util.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -688,9 +688,7 @@ static private void packageListFromFolder(File dir, String sofar,
688688
* Ignores (does not extract) any __MACOSX files from macOS archives.
689689
*/
690690
static public void unzip(File zipFile, File dest) throws IOException {
691-
FileInputStream fis = new FileInputStream(zipFile);
692-
CheckedInputStream checksum = new CheckedInputStream(fis, new Adler32());
693-
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(checksum));
691+
try (ZipInputStream zis = new ZipInputStream( new BufferedInputStream( new CheckedInputStream( new FileInputStream(zipFile), new Adler32())))) {
694692
ZipEntry entry;
695693
while ((entry = zis.getNextEntry()) != null) {
696694
final String name = entry.getName();
@@ -710,6 +708,7 @@ static public void unzip(File zipFile, File dest) throws IOException {
710708
}
711709
}
712710
}
711+
}
713712

714713

715714
static protected void unzipEntry(ZipInputStream zin, File f) throws IOException {

0 commit comments

Comments
 (0)