-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
12
-
x86_64
-
windows_10
A DESCRIPTION OF THE PROBLEM :
When using Java SE 12.0.1 the list returned from ProxySelector.getDefault().select() always returns only one entry and that entry is of Type.DIRECT even when the client is behind a proxy.
This issue also exists in Java SE 13. But the problem does not exist (and the expected behavior happens) when using Java SE 8 update 201.
REGRESSION : Last worked in version 8
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Request the list of proxies for a URI (with a proxy in place) with the following method:
List proxyList = ProxySelector.getDefault().select(configURI);
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
When run with a proxy in place the returned list should contain proxy entries that include Type.HTTP and/or Type.SOCKS
ACTUAL -
The call ALWAYS returns only one result, and that result is always a proxy entry of Type.DIRECT
---------- BEGIN SOURCE ----------
try {
System.setProperty("java.net.useSystemProxies","true");
URL configURL = "https://www.google.com";
URI configURI = null;
try {
configURI = configURL.toURI();
}
catch (Exception ex2) {
System.out.println("Unable to convert configURL to URI. Error: " + ex2.toString());
}
boolean bFoundProxyInfo = false;
List proxyList = ProxySelector.getDefault().select(configURI);
for (Iterator iter = proxyList.iterator(); iter.hasNext();) {
Proxy proxy = (Proxy)iter.next();
System.out.println("Proxy: " + proxy);
System.out.println("Proxy type: " + proxy.type());
InetSocketAddress addr = (InetSocketAddress)proxy.address();
if (addr != null) {
bFoundProxyInfo = true;
host = addr.getHostName();
port = String.valueOf(addr.getPort());
System.out.println("Proxy hostname: " + host);
System.out.println("Proxy port: " + port);
}
if (bFoundProxyInfo) break;
}
}
catch (Exception ex) {
System.out.println("Unable to find proxy information using ProxySelector. Error: " + ex.toString());
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
None.
FREQUENCY : always
When using Java SE 12.0.1 the list returned from ProxySelector.getDefault().select() always returns only one entry and that entry is of Type.DIRECT even when the client is behind a proxy.
This issue also exists in Java SE 13. But the problem does not exist (and the expected behavior happens) when using Java SE 8 update 201.
REGRESSION : Last worked in version 8
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Request the list of proxies for a URI (with a proxy in place) with the following method:
List proxyList = ProxySelector.getDefault().select(configURI);
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
When run with a proxy in place the returned list should contain proxy entries that include Type.HTTP and/or Type.SOCKS
ACTUAL -
The call ALWAYS returns only one result, and that result is always a proxy entry of Type.DIRECT
---------- BEGIN SOURCE ----------
try {
System.setProperty("java.net.useSystemProxies","true");
URL configURL = "https://www.google.com";
URI configURI = null;
try {
configURI = configURL.toURI();
}
catch (Exception ex2) {
System.out.println("Unable to convert configURL to URI. Error: " + ex2.toString());
}
boolean bFoundProxyInfo = false;
List proxyList = ProxySelector.getDefault().select(configURI);
for (Iterator iter = proxyList.iterator(); iter.hasNext();) {
Proxy proxy = (Proxy)iter.next();
System.out.println("Proxy: " + proxy);
System.out.println("Proxy type: " + proxy.type());
InetSocketAddress addr = (InetSocketAddress)proxy.address();
if (addr != null) {
bFoundProxyInfo = true;
host = addr.getHostName();
port = String.valueOf(addr.getPort());
System.out.println("Proxy hostname: " + host);
System.out.println("Proxy port: " + port);
}
if (bFoundProxyInfo) break;
}
}
catch (Exception ex) {
System.out.println("Unable to find proxy information using ProxySelector. Error: " + ex.toString());
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
None.
FREQUENCY : always
- duplicates
-
JDK-8262442 (windows) Use all proxy configuration sources when java.net.useSystemProxies=true
-
- Resolved
-