private void populateProxyCommands( List<String> commands, String commandFlag )
throws MojoExecutionException
{
if ( proxy != null )
{
Proxy mProxy = getProxyFor( proxy.getId() );
if ( mProxy != null )
{
getLog().debug( "NPANDAY-1300-003: Found proxy: ID = " + mProxy.getId() );
String username = mProxy.getUsername();
String password = mProxy.getPassword();
boolean isHashed = proxy.isHashPassword();
if ( !isEmpty( password ) && isHashed )
{
String alg = proxy.getHashAlg();
if ( isEmpty( alg ) )
{
alg = "SHA1";
}
try
{
password = new String( MessageDigest.getInstance( alg ).digest( password.getBytes() ) );
}
catch ( NoSuchAlgorithmException e )
{
throw new MojoExecutionException(
"NPANDAY-1300-004: No Such Algorithm for hashing the password: "
+ "Algorithm = " + alg, e );
}
}
String proxyHost = mProxy.getHost();
int proxyPort = mProxy.getPort();
String proxyProtocol = mProxy.getProtocol();
StringBuffer proxyUrl = new StringBuffer();
if ( !isEmpty( proxyProtocol ) )
{
proxyUrl.append( proxyProtocol ).append( "://" );