Skip to content

Commit d5ba619

Browse files
committed
fix: close ZipFile in GitLoader
1 parent 70298df commit d5ba619

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/main/java/org/variantsync/diffdetective/load/GitLoader.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.variantsync.diffdetective.load;
22

33
import net.lingala.zip4j.ZipFile;
4-
import net.lingala.zip4j.exception.ZipException;
54
import org.apache.commons.io.FilenameUtils;
65
import org.eclipse.jgit.api.Git;
76
import org.eclipse.jgit.api.errors.GitAPIException;
@@ -86,10 +85,9 @@ public static Git fromZip(Path pathToZip) {
8685
return fromDirectory(unzippedRepoName);
8786
}
8887

89-
try {
90-
ZipFile zipFile = new ZipFile(pathToZip.toFile());
88+
try (ZipFile zipFile = new ZipFile(pathToZip.toFile())) {
9189
zipFile.extractAll(targetDir.toString());
92-
} catch (ZipException e) {
90+
} catch (IOException e) {
9391
Logger.warn("Failed to extract git repo from {} to {}", pathToZip, targetDir);
9492
return null;
9593
}

0 commit comments

Comments
 (0)