@@ -186,20 +186,19 @@ public void configure(Settings settings) throws InvalidSettingException {
186186 // set a conservatively long default timeout to compensate for MITM-proxies that return the (final) bytes only
187187 // after all security checks passed
188188 final int readTimeout = settings .getInt (Settings .KEYS .CONNECTION_READ_TIMEOUT , 60_000 );
189-
190189 connectionManager .setDefaultConnectionConfig (
191190 ConnectionConfig .custom ()
192191 .setConnectTimeout (connectionTimeout , TimeUnit .MILLISECONDS )
193192 .setSocketTimeout (readTimeout , TimeUnit .MILLISECONDS )
194193 .build ()
195194 );
196- if (settings .getString (Settings .KEYS .PROXY_SERVER ) != null ) {
195+ if (! settings .getString (Settings .KEYS .PROXY_SERVER , "" ). isBlank () ) {
197196 // Legacy proxy configuration present
198197 // So don't rely on the system properties for proxy; use the legacy settings configuration
199198 final String proxyHost = settings .getString (Settings .KEYS .PROXY_SERVER );
200199 final int proxyPort = settings .getInt (Settings .KEYS .PROXY_PORT , -1 );
201- final String nonProxyHosts = settings .getString (Settings .KEYS .PROXY_NON_PROXY_HOSTS );
202- if (nonProxyHosts != null && ! nonProxyHosts .isEmpty ()) {
200+ final String nonProxyHosts = settings .getString (Settings .KEYS .PROXY_NON_PROXY_HOSTS , "" );
201+ if (! nonProxyHosts .isBlank ()) {
203202 final ProxySelector selector = new SelectiveProxySelector (
204203 new Proxy (Proxy .Type .HTTP , new InetSocketAddress (proxyHost , proxyPort )),
205204 nonProxyHosts .split ("\\ |" )
@@ -208,7 +207,7 @@ public void configure(Settings settings) throws InvalidSettingException {
208207 } else {
209208 httpClientBuilder .setProxy (new HttpHost (proxyHost , proxyPort ));
210209 }
211- if (settings .getString (Settings .KEYS .PROXY_USERNAME ) != null ) {
210+ if (! settings .getString (Settings .KEYS .PROXY_USERNAME , "" ). isBlank () && ! settings . getString ( Settings . KEYS . PROXY_PASSWORD , "" ). isBlank () ) {
212211 final String proxyuser = settings .getString (Settings .KEYS .PROXY_USERNAME );
213212 final char [] proxypass = settings .getString (Settings .KEYS .PROXY_PASSWORD ).toCharArray ();
214213 this .proxyHttpHost = new HttpHost (null , proxyHost , proxyPort );
0 commit comments