@@ -450,36 +450,39 @@ private static List<String> getDockerRunCmd(String builder, String scriptToRun,
450
450
* @return proxy url for given protocol
451
451
*/
452
452
public static String findProxyUrl (String proxyUrl , String protocol ) {
453
- String retVal = proxyUrl ;
454
- if (isEmptyString (retVal ) && !isEmptyString (protocol )) {
455
- switch (protocol .toLowerCase ()) {
456
- case Constants .HTTP :
457
- case Constants .HTTPS :
458
- String envVarName = String .format ("%s_proxy" , protocol );
459
- retVal = getProxyEnvironmentVariableValue (envVarName );
460
- if (isEmptyString (retVal )) {
461
- String proxyHost = System .getProperty (String .format ("%s.proxyHost" , protocol ), null );
462
- String proxyPort = System .getProperty (String .format ("%s.proxyPort" , protocol ), "80" );
463
- if (proxyHost != null ) {
464
- retVal = String .format ("%s://%s:%s" , protocol , proxyHost , proxyPort );
465
- }
453
+ if (!isEmptyString (proxyUrl )) {
454
+ return proxyUrl ;
455
+ }
456
+ String result ;
457
+ switch (protocol .toLowerCase ()) {
458
+ case Constants .HTTP :
459
+ case Constants .HTTPS :
460
+ String envVarName = String .format ("%s_proxy" , protocol );
461
+ result = getProxyEnvironmentVariableValue (envVarName );
462
+ if (isEmptyString (result )) {
463
+ String proxyHost = System .getProperty (String .format ("%s.proxyHost" , protocol ), null );
464
+ String proxyPort = System .getProperty (String .format ("%s.proxyPort" , protocol ), "80" );
465
+ if (proxyHost != null ) {
466
+ result = String .format ("%s://%s:%s" , protocol , proxyHost , proxyPort );
466
467
}
467
- break ;
468
- case "none" :
469
- default :
470
- retVal = getProxyEnvironmentVariableValue ("no_proxy" );
471
- if (isEmptyString (retVal )) {
472
- retVal = System .getProperty ("http.nonProxyHosts" , null );
473
- if (!isEmptyString (retVal )) {
474
- //http.nonProxyHosts property uses | instead of , as a separator
475
- retVal = retVal .replace ("|" , "," );
476
- }
468
+ }
469
+ break ;
470
+ case "none" :
471
+ default :
472
+ result = getProxyEnvironmentVariableValue ("no_proxy" );
473
+ if (isEmptyString (result )) {
474
+ String propertyValue = System .getProperty ("http.nonProxyHosts" , null );
475
+ if (isEmptyString (propertyValue )) {
476
+ result = null ;
477
+ } else {
478
+ //http.nonProxyHosts property uses | instead of , as a separator
479
+ result = propertyValue .replace ("|" , "," );
477
480
}
478
- break ;
479
- }
481
+ }
482
+ break ;
480
483
}
481
- logger .finer ("Discovered proxy setting ({0}): {1}" , protocol , retVal );
482
- return retVal ;
484
+ logger .finer ("Discovered proxy setting ({0}): {1}" , protocol , result );
485
+ return result ;
483
486
}
484
487
485
488
/**
0 commit comments