Workaround for bug 3168560, synchronize system proxy access
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1612 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
9225305e48
commit
801148e890
|
@ -60,6 +60,7 @@ public final class DavGatewayHttpClientFacade {
|
|||
static final String IE_USER_AGENT = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)";
|
||||
static final int MAX_REDIRECTS = 10;
|
||||
static final Object LOCK = new Object();
|
||||
static final Object PROXY_LOCK = new Object();
|
||||
private static boolean needNTLM;
|
||||
|
||||
static final long ONE_MINUTE = 60000;
|
||||
|
@ -165,6 +166,7 @@ public final class DavGatewayHttpClientFacade {
|
|||
if (useSystemProxies) {
|
||||
// get proxy for url from system settings
|
||||
System.setProperty("java.net.useSystemProxies", "true");
|
||||
synchronized (PROXY_LOCK) {
|
||||
try {
|
||||
List<Proxy> proxyList = ProxySelector.getDefault().select(new java.net.URI(url));
|
||||
if (!proxyList.isEmpty() && proxyList.get(0).address() != null) {
|
||||
|
@ -179,8 +181,7 @@ public final class DavGatewayHttpClientFacade {
|
|||
} catch (URISyntaxException e) {
|
||||
throw new DavMailException("LOG_INVALID_URL", url);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} else if (enableProxy) {
|
||||
proxyHost = Settings.getProperty("davmail.proxyHost");
|
||||
proxyPort = Settings.getIntProperty("davmail.proxyPort");
|
||||
|
|
Loading…
Reference in New Issue