< prev index next >

src/java.base/share/classes/sun/net/spi/DefaultProxySelector.java

Print this page

        

*** 28,47 **** import java.net.InetSocketAddress; import java.net.Proxy; import java.net.ProxySelector; import java.net.SocketAddress; import java.net.URI; ! import java.util.Arrays; import java.util.List; import java.io.IOException; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.StringJoiner; import java.util.regex.Pattern; import sun.net.NetProperties; import sun.net.SocksProxy; import static java.util.regex.Pattern.quote; /** * Supports proxy settings using system properties This proxy selector * provides backward compatibility with the old http protocol handler * as far as how proxy is set --- 28,50 ---- import java.net.InetSocketAddress; import java.net.Proxy; import java.net.ProxySelector; import java.net.SocketAddress; import java.net.URI; ! import java.util.Collections; import java.util.List; import java.io.IOException; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.StringJoiner; import java.util.regex.Pattern; + import java.util.stream.Stream; import sun.net.NetProperties; import sun.net.SocksProxy; import static java.util.regex.Pattern.quote; + import static java.util.stream.Collectors.collectingAndThen; + import static java.util.stream.Collectors.toList; /** * Supports proxy settings using system properties This proxy selector * provides backward compatibility with the old http protocol handler * as far as how proxy is set
*** 316,328 **** } } return null; }}); ! // If no specific proxy was found we return our standard list containing // only one NO_PROXY entry. ! return proxyArray == null ? NO_PROXY_LIST : List.of(proxyArray); } public void connectFailed(URI uri, SocketAddress sa, IOException ioe) { if (uri == null || sa == null || ioe == null) { throw new IllegalArgumentException("Arguments can't be null."); --- 319,338 ---- } } return null; }}); ! ! if (proxyArray != null) { ! // Remove duplicate entries, while preserving order. ! return Stream.of(proxyArray).distinct().collect( ! collectingAndThen(toList(), Collections::unmodifiableList)); ! } ! ! // If no specific proxy was found, return a standard list containing // only one NO_PROXY entry. ! return NO_PROXY_LIST; } public void connectFailed(URI uri, SocketAddress sa, IOException ioe) { if (uri == null || sa == null || ioe == null) { throw new IllegalArgumentException("Arguments can't be null.");
< prev index next >