[FIX] Фикс LauncherRequest

This commit is contained in:
Gravit 2019-04-03 23:20:38 +07:00
parent 558ad30e24
commit 7b695e77ad
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
2 changed files with 9 additions and 11 deletions

View file

@ -38,21 +38,17 @@ public void download(String base, List<String> applies, Path dstDirFile) throws
}
}
public static void downloadOne(String url, Path target) throws IOException, URISyntaxException
public void downloadOne(String url, Path target) throws IOException, URISyntaxException
{
try (CloseableHttpClient httpclient = HttpClients.custom()
.setRedirectStrategy(new LaxRedirectStrategy())
.build()) {
HttpGet get = null;
HttpGet get;
URI u = new URL(url).toURI();
LogHelper.debug("Download URL: %s", u.toString());
if (get == null) get = new HttpGet(u);
else {
get.reset();
get.setURI(u);
}
httpclient.execute(get, new FileDownloadResponseHandler(target));
get = new HttpGet(u);
httpclient.execute(get, new FileDownloadResponseHandler(target.toAbsolutePath()));
}
}

View file

@ -56,9 +56,11 @@ public static void update(LauncherConfig config, LauncherRequestEvent result) th
IOHelper.transfer(BINARY_PATH, stream);
}*/
try {
ListDownloader.downloadOne(result.url, BINARY_PATH);
} catch (URISyntaxException e) {
throw new SecurityException(e);
ListDownloader downloader = new ListDownloader();
downloader.downloadOne(result.url, BINARY_PATH);
} catch(Throwable e)
{
LogHelper.error(e);
}
}
builder.start();