1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-13 19:22:22 -05:00

Additional statement on proxy load

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1692 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2011-05-23 21:40:45 +00:00
parent bf570104d2
commit 798e261d6c

View File

@ -75,11 +75,6 @@ public final class DavGatewayHttpClientFacade {
// register custom cookie policy
CookiePolicy.registerCookieSpec("DavMailCookieSpec", DavMailCookieSpec.class);
// Load system proxy settings to avoid futex deadlock on linux
if (Settings.getBooleanProperty("davmail.useSystemProxies")) {
System.setProperty("java.net.useSystemProxies", "true");
ProxySelector.getDefault();
}
}
@ -172,7 +167,7 @@ public final class DavGatewayHttpClientFacade {
// get proxy for url from system settings
System.setProperty("java.net.useSystemProxies", "true");
try {
List<Proxy> proxyList = ProxySelector.getDefault().select(new java.net.URI(url));
List<Proxy> proxyList = getDefaultProxySelector().select(new java.net.URI(url));
if (!proxyList.isEmpty() && proxyList.get(0).address() != null) {
InetSocketAddress inetSocketAddress = (InetSocketAddress) proxyList.get(0).address();
proxyHost = inetSocketAddress.getHostName();
@ -215,6 +210,18 @@ public final class DavGatewayHttpClientFacade {
}
/**
* Retrieve Proxy Selector
*
* @return proxy selector
*/
private static ProxySelector getDefaultProxySelector() {
LOGGER.debug("Loading system proxy settings...");
ProxySelector proxySelector = ProxySelector.getDefault();
LOGGER.debug("Loaded ProxySelector " + proxySelector);
return proxySelector;
}
/**
* Get Http Status code for the given URL