From ffe7e443d23ccb8807168d0d1ae7df0633abe388 Mon Sep 17 00:00:00 2001 From: Godin Date: Tue, 21 Dec 2010 23:34:06 +0000 Subject: [PATCH] Minor fix --- .../java/org/sonar/api/utils/HttpDownloader.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpDownloader.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpDownloader.java index c1c3bebf016..71ea6f72ff6 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpDownloader.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpDownloader.java @@ -39,13 +39,13 @@ import java.util.List; /** * This component downloads HTTP files - * + * * @since 2.2 */ public class HttpDownloader implements BatchComponent, ServerComponent { public static final int TIMEOUT_MILLISECONDS = 20 * 1000; - + private String userAgent; public HttpDownloader(Server server, Configuration configuration) { @@ -101,7 +101,8 @@ public class HttpDownloader implements BatchComponent, ServerComponent { } private void registerProxyCredentials(Configuration configuration) { - Authenticator.setDefault(new ProxyAuthenticator(configuration.getString("http.proxyUser"), configuration.getString("http.proxyPassword"))); + Authenticator.setDefault(new ProxyAuthenticator(configuration.getString("http.proxyUser"), configuration + .getString("http.proxyPassword"))); } private boolean requiresProxyAuthentication(Configuration configuration) { @@ -135,7 +136,7 @@ public class HttpDownloader implements BatchComponent, ServerComponent { } catch (Exception e) { IOUtils.closeQuietly(output); FileUtils.deleteQuietly(toFile); - throw new SonarException("Fail to download the file: " + uri + getProxySynthesis(uri), e); + throw new SonarException("Fail to download the file: " + uri + " (" + getProxySynthesis(uri) + ")", e); } finally { IOUtils.closeQuietly(input); @@ -151,7 +152,7 @@ public class HttpDownloader implements BatchComponent, ServerComponent { return IOUtils.toByteArray(input); } catch (Exception e) { - throw new SonarException("Fail to download the file: " + uri + getProxySynthesis(uri), e); + throw new SonarException("Fail to download the file: " + uri + " (" + getProxySynthesis(uri) + ")", e); } finally { IOUtils.closeQuietly(input); @@ -164,12 +165,12 @@ public class HttpDownloader implements BatchComponent, ServerComponent { return connection.getInputStream(); } catch (Exception e) { - throw new SonarException("Fail to download the file: " + uri + getProxySynthesis(uri), e); + throw new SonarException("Fail to download the file: " + uri + " (" + getProxySynthesis(uri) + ")", e); } } private HttpURLConnection newHttpConnection(URI uri) throws IOException { - LoggerFactory.getLogger(getClass()).info("Download: " + uri + getProxySynthesis(uri)); + LoggerFactory.getLogger(getClass()).info("Download: " + uri + " (" + getProxySynthesis(uri) + ")"); HttpURLConnection connection = (HttpURLConnection) uri.toURL().openConnection(); connection.setConnectTimeout(TIMEOUT_MILLISECONDS); connection.setReadTimeout(TIMEOUT_MILLISECONDS); -- 2.39.5