fix: LZMAInputStream not closed

This commit is contained in:
Glavo authored and Yuhui Huang committed 2021-09-03 14:41:24 +08:00
1 parent 665b0c4390
commit faede16662
1 file changed
+2 -2
@@ -98,8 +98,8 @@ public class JavaDownloadTask extends Task<Void> {
FileDownloadTask task = new FileDownloadTask(NetworkUtils.toURL(download.getUrl()), tempFile, new FileDownloadTask.IntegrityCheck("SHA-1", download.getSha1()));
task.setName(entry.getKey());
dependencies.add(task.thenRunAsync(() -> {
try {
Files.copy(new LZMAInputStream(new FileInputStream(tempFile)), dest);
try (LZMAInputStream input = new LZMAInputStream(new FileInputStream(tempFile))) {
Files.copy(input, dest);
} catch (IOException e) {
throw new ArtifactMalformedException("File " + entry.getKey() + " is malformed");
}