protected Object activateProxy ( ) { if ( settings == null ) { return null ; } final Proxy proxy = settings . getActiveProxy ( ) ; if ( proxy == null ) { return null ; } final List < String > properties = new ArrayList < String > ( ) ; final String protocol = proxy . getProtocol ( ) ; final String prefix = isEmpty ( protocol ) ? "" : ( protocol + "." ) ; final String host = proxy . getHost ( ) ; final String hostProperty = prefix + "proxyHost" ; final String hostValue = isEmpty ( host ) ? null : host ; setProperty ( properties , hostProperty , hostValue ) ; final int port = proxy . getPort ( ) ; final String portProperty = prefix + "proxyPort" ; final String portValue = ( port == 0 || port == - 1 ) ? null : String . valueOf ( port ) ; setProperty ( properties , portProperty , portValue ) ; final String username = proxy . getUsername ( ) ; final String userProperty = prefix + "proxyUser" ; final String userValue = isEmpty ( username ) ? null : username ; setProperty ( properties , userProperty , userValue ) ; final String password = proxy . getPassword ( ) ; final String passwordProperty = prefix + "proxyPassword" ; final String passwordValue = isEmpty ( password ) ? null : password ; setProperty ( properties , passwordProperty , passwordValue ) ; final String nonProxyHosts = proxy . getNonProxyHosts ( ) ; final String nonProxyHostsProperty = prefix + "nonProxyHosts" ; final String nonProxyHostsValue = isEmpty ( nonProxyHosts ) ? null : nonProxyHosts . replace ( ' ' , ' ' ) ; setProperty ( properties , nonProxyHostsProperty , nonProxyHostsValue ) ; getLog ( ) . debug ( "Proxy settings: " + hostProperty + "=" + hostValue + ", " + portProperty + "=" + portValue + ", " + userProperty + "=" + userValue + ", " + passwordProperty + "=" + ( passwordValue == null ? "null" : "<PasswordNotLogged>" ) + ", " + nonProxyHostsProperty + "=" + nonProxyHostsValue ) ; return properties ; }
Called to install the plugins proxy settings .