From fe086df94550d2faea84ecbc2c76fe8d63c4bd6e Mon Sep 17 00:00:00 2001 From: kohsuke Date: Sat, 24 Oct 2009 00:15:29 +0000 Subject: [PATCH] Automated tool downloads are made more robust by using HTTP download retries. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@23122 71c3de6d-444a-0410-be80-ed276b4c234a --- core/src/main/java/hudson/FilePath.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/hudson/FilePath.java b/core/src/main/java/hudson/FilePath.java index 89b008ba4d..4a22cf9826 100644 --- a/core/src/main/java/hudson/FilePath.java +++ b/core/src/main/java/hudson/FilePath.java @@ -58,6 +58,7 @@ import org.apache.commons.io.IOUtils; import org.apache.commons.io.input.CountingInputStream; import org.apache.commons.fileupload.FileItem; import org.kohsuke.stapler.Stapler; +import org.jvnet.robust_http_client.RetryableHttpStream; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; @@ -557,7 +558,9 @@ public final class FilePath implements Serializable { if(listener!=null) listener.getLogger().println(message); - CountingInputStream cis = new CountingInputStream(con.getInputStream()); + // for HTTP downloads, enable automatic retry for added resilience + InputStream in = archive.getProtocol().equals("http") ? new RetryableHttpStream(archive) : con.getInputStream(); + CountingInputStream cis = new CountingInputStream(in); try { if(archive.toExternalForm().endsWith(".zip")) unzipFrom(cis);