// MRM-631 - the lightweight wagon does not reset these - remove if we switch to httpclient based wagon
String previousHttpProxyHost = System.getProperty( "http.proxyHost" );
String previousHttpProxyPort = System.getProperty( "http.proxyPort" );
String previousProxyExclusions = System.getProperty( "http.nonProxyHosts" );
Wagon wagon = null;
try
{
RepositoryURL repoUrl = remoteRepository.getURL();
String protocol = repoUrl.getProtocol();
wagon = (Wagon) wagonFactory.getWagon( "wagon#" + protocol );
if ( wagon == null )
{
throw new ProxyException( "Unsupported target repository protocol: " + protocol );
}
boolean connected = connectToRepository( connector, wagon, remoteRepository );
if ( connected )
{
localFile = transferSimpleFile( wagon, remoteRepository, remotePath, repository, localFile );
// TODO: these should be used to validate the download based on the policies, not always downloaded to
// save on connections since md5 is rarely used
transferChecksum( wagon, remoteRepository, remotePath, repository, localFile, ".sha1" );
transferChecksum( wagon, remoteRepository, remotePath, repository, localFile, ".md5" );
}
}
catch ( NotFoundException e )
{
urlFailureCache.cacheFailure( url );
throw e;
}
catch ( NotModifiedException e )
{
// Do not cache url here.
throw e;
}
catch ( ProxyException e )
{
urlFailureCache.cacheFailure( url );
throw e;
}
finally
{
if ( wagon != null )
{
try
{
wagon.disconnect();
// MRM-631 - the lightweight wagon does not reset these - remove if we switch to httpclient based wagon
if ( previousHttpProxyHost != null )
{
System.setProperty( "http.proxyHost", previousHttpProxyHost );