fix: fail to update
This commit is contained in:
@@ -52,7 +52,7 @@ public final class ForgeInstallTask extends Task<Version> {
|
|||||||
private final Version version;
|
private final Version version;
|
||||||
private Path installer;
|
private Path installer;
|
||||||
private final ForgeRemoteVersion remote;
|
private final ForgeRemoteVersion remote;
|
||||||
private Task<Void> dependent;
|
private FileDownloadTask dependent;
|
||||||
private Task<Version> dependency;
|
private Task<Version> dependency;
|
||||||
|
|
||||||
public ForgeInstallTask(DefaultDependencyManager dependencyManager, Version version, ForgeRemoteVersion remoteVersion) {
|
public ForgeInstallTask(DefaultDependencyManager dependencyManager, Version version, ForgeRemoteVersion remoteVersion) {
|
||||||
@@ -75,6 +75,7 @@ public final class ForgeInstallTask extends Task<Version> {
|
|||||||
installer.toFile(), null)
|
installer.toFile(), null)
|
||||||
.setCacheRepository(dependencyManager.getCacheRepository())
|
.setCacheRepository(dependencyManager.getCacheRepository())
|
||||||
.setCaching(true);
|
.setCaching(true);
|
||||||
|
dependent.addIntegrityCheckHandler(FileDownloadTask.ZIP_INTEGRITY_CHECK_HANDLER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -26,8 +26,6 @@ import org.jackhuang.hmcl.task.FileDownloadTask;
|
|||||||
import org.jackhuang.hmcl.task.FileDownloadTask.IntegrityCheck;
|
import org.jackhuang.hmcl.task.FileDownloadTask.IntegrityCheck;
|
||||||
import org.jackhuang.hmcl.task.Task;
|
import org.jackhuang.hmcl.task.Task;
|
||||||
import org.jackhuang.hmcl.util.Logging;
|
import org.jackhuang.hmcl.util.Logging;
|
||||||
import org.jackhuang.hmcl.util.StringUtils;
|
|
||||||
import org.jackhuang.hmcl.util.io.CompressingUtils;
|
|
||||||
import org.jackhuang.hmcl.util.io.FileUtils;
|
import org.jackhuang.hmcl.util.io.FileUtils;
|
||||||
import org.jackhuang.hmcl.util.io.IOUtils;
|
import org.jackhuang.hmcl.util.io.IOUtils;
|
||||||
import org.jackhuang.hmcl.util.io.NetworkUtils;
|
import org.jackhuang.hmcl.util.io.NetworkUtils;
|
||||||
@@ -36,7 +34,6 @@ import org.tukaani.xz.XZInputStream;
|
|||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.FileSystem;
|
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -142,6 +139,7 @@ public class LibraryDownloadTask extends Task<Void> {
|
|||||||
library.getDownload().getSha1() != null ? new IntegrityCheck("SHA-1", library.getDownload().getSha1()) : null)
|
library.getDownload().getSha1() != null ? new IntegrityCheck("SHA-1", library.getDownload().getSha1()) : null)
|
||||||
.setCacheRepository(cacheRepository)
|
.setCacheRepository(cacheRepository)
|
||||||
.setCaching(true);
|
.setCaching(true);
|
||||||
|
task.addIntegrityCheckHandler(FileDownloadTask.ZIP_INTEGRITY_CHECK_HANDLER);
|
||||||
xz = false;
|
xz = false;
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|||||||
@@ -156,8 +156,6 @@ public class FileDownloadTask extends Task<Void> {
|
|||||||
this.integrityCheck = integrityCheck;
|
this.integrityCheck = integrityCheck;
|
||||||
this.retry = retry;
|
this.retry = retry;
|
||||||
|
|
||||||
this.addIntegrityCheckHandler(ZIP_INTEGRITY_CHECK_HANDLER);
|
|
||||||
|
|
||||||
setName(file.getName());
|
setName(file.getName());
|
||||||
setExecutor(Schedulers.io());
|
setExecutor(Schedulers.io());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -178,9 +178,9 @@ public final class CompressingUtils {
|
|||||||
// Since Java 8 throws ZipError stupidly
|
// Since Java 8 throws ZipError stupidly
|
||||||
throw new ZipException(error.getMessage());
|
throw new ZipException(error.getMessage());
|
||||||
} catch (UnsupportedOperationException ex) {
|
} catch (UnsupportedOperationException ex) {
|
||||||
throw new IOException("Not a zip file", ex);
|
throw new ZipException("Not a zip file");
|
||||||
} catch (FileSystemNotFoundException ex) {
|
} catch (FileSystemNotFoundException ex) {
|
||||||
throw new IOException("Java Environment is broken");
|
throw new ZipException("Java Environment is broken");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user