From 911f469631ace0f88711466f6da0c36f50317841 Mon Sep 17 00:00:00 2001 From: kohsuke Date: Wed, 5 Nov 2008 23:23:35 +0000 Subject: [PATCH] Improved error diagnostics in the update center when the proxy configuration is likely necessary. (discussion) In 1.260 git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@13012 71c3de6d-444a-0410-be80-ed276b4c234a --- core/src/main/java/hudson/model/UpdateCenter.java | 10 +++++++++- .../main/resources/hudson/model/Messages.properties | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/hudson/model/UpdateCenter.java b/core/src/main/java/hudson/model/UpdateCenter.java index 961b6f6b15..44e3634d21 100644 --- a/core/src/main/java/hudson/model/UpdateCenter.java +++ b/core/src/main/java/hudson/model/UpdateCenter.java @@ -420,7 +420,15 @@ public class UpdateCenter extends AbstractModelObject { public void run() { try { statuses.add(Messages.UpdateCenter_Status_CheckingInternet()); - testConnection(new URL("http://www.google.com/")); + try { + testConnection(new URL("http://www.google.com/")); + } catch (IOException e) { + if(e.getMessage().contains("Connection timed out")) { + // Google can't be down, so this is probably a proxy issue + statuses.add(Messages.UpdateCenter_Status_ConnectionFailed("www.google.com")); + return; + } + } statuses.add(Messages.UpdateCenter_Status_CheckingJavaNet()); testConnection(new URL("https://hudson.dev.java.net/?uctest")); diff --git a/core/src/main/resources/hudson/model/Messages.properties b/core/src/main/resources/hudson/model/Messages.properties index c96d5d9fe5..74cc7f47c3 100644 --- a/core/src/main/resources/hudson/model/Messages.properties +++ b/core/src/main/resources/hudson/model/Messages.properties @@ -120,6 +120,9 @@ UpdateCenter.Status.Success=Success UpdateCenter.Status.UnknownHostException=\ Failed to resolve host name {0}. \ Perhaps you need to configure HTTP proxy? +UpdateCenter.Status.ConnectionFailed=\ + Failed to connect to {0}. \ + Perhaps you need to configure HTTP proxy? Permalink.LastBuild=Last build Permalink.LastStableBuild=Last stable build