fix: incorrect log in GetTask

This commit is contained in:
huanghongxun 2020-02-11 13:12:36 +08:00
parent 89dbc1be4a
commit 8b16e8be4d

View File

@ -82,6 +82,7 @@ public final class GetTask extends Task<String> {
@Override @Override
public void execute() throws Exception { public void execute() throws Exception {
Exception exception = null; Exception exception = null;
URL failedURL = null;
boolean checkETag = true; boolean checkETag = true;
for (int time = 0; time < retry; ++time) { for (int time = 0; time < retry; ++time) {
URL url = urls.get(time % urls.size()); URL url = urls.get(time % urls.size());
@ -132,12 +133,13 @@ public final class GetTask extends Task<String> {
} }
return; return;
} catch (IOException ex) { } catch (IOException ex) {
failedURL = url;
exception = ex; exception = ex;
Logging.LOG.log(Level.WARNING, "Failed to download " + url + ", repeat times: " + time + 1, ex); Logging.LOG.log(Level.WARNING, "Failed to download " + url + ", repeat times: " + (time + 1), ex);
} }
} }
if (exception != null) if (exception != null)
throw new DownloadException(urls.get(0), exception); throw new DownloadException(failedURL, exception);
} }
} }