提交 7cdd9ee0 编写于 作者: K kohsuke

improved error diagnosis.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@20043 71c3de6d-444a-0410-be80-ed276b4c234a
上级 76aec326
......@@ -40,11 +40,13 @@ import net.sf.json.JSONObject;
import org.acegisecurity.Authentication;
import org.apache.commons.io.input.CountingInputStream;
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.output.NullOutputStream;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import javax.servlet.ServletException;
import javax.net.ssl.SSLHandshakeException;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
......@@ -69,6 +71,8 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
import sun.security.validator.ValidatorException;
/**
* Controls update center capability.
*
......@@ -637,9 +641,15 @@ public class UpdateCenter extends AbstractModelObject {
private void testConnection(URL url) throws IOException {
InputStream in = ProxyConfiguration.open(url).getInputStream();
IOUtils.copy(in,new ByteArrayOutputStream());
in.close();
try {
InputStream in = ProxyConfiguration.open(url).getInputStream();
IOUtils.copy(in,new NullOutputStream());
in.close();
} catch (SSLHandshakeException e) {
if (e.getMessage().contains("PKIX path building failed"))
// fix up this crappy error message from JDK
throw new IOException2("Failed to validate the SSL certificate of "+url,e);
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册