mirror of https://github.com/apache/maven.git
[MNG-2741] [regression] Meaningless error message: "Error transferring file"
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@929217 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9020e459a1
commit
aa68fb033b
|
@ -631,11 +631,11 @@ public class LegacyRepositorySystem
|
|||
}
|
||||
catch ( org.apache.maven.wagon.TransferFailedException e )
|
||||
{
|
||||
throw new ArtifactTransferFailedException( "Error transferring artifact.", e );
|
||||
throw new ArtifactTransferFailedException( getMessage( e, "Error transferring artifact." ), e );
|
||||
}
|
||||
catch ( org.apache.maven.wagon.ResourceDoesNotExistException e )
|
||||
{
|
||||
throw new ArtifactDoesNotExistException( "Requested artifact does not exist.", e );
|
||||
throw new ArtifactDoesNotExistException( getMessage( e, "Requested artifact does not exist." ), e );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -649,7 +649,7 @@ public class LegacyRepositorySystem
|
|||
}
|
||||
catch ( org.apache.maven.wagon.TransferFailedException e )
|
||||
{
|
||||
throw new ArtifactTransferFailedException( "Error transferring artifact.", e );
|
||||
throw new ArtifactTransferFailedException( getMessage( e, "Error transferring artifact." ), e );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -708,4 +708,18 @@ public class LegacyRepositorySystem
|
|||
return artifactRepository;
|
||||
}
|
||||
|
||||
private static String getMessage( Throwable error, String def )
|
||||
{
|
||||
if ( error == null )
|
||||
{
|
||||
return def;
|
||||
}
|
||||
String msg = error.getMessage();
|
||||
if ( StringUtils.isNotEmpty( msg ) )
|
||||
{
|
||||
return msg;
|
||||
}
|
||||
return getMessage( error.getCause(), def );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -170,7 +171,7 @@ public class DefaultPluginPrefixResolver
|
|||
}
|
||||
}
|
||||
|
||||
List<ArtifactRepository> recheck = new ArrayList<ArtifactRepository>();
|
||||
Map<String, List<ArtifactRepository>> recheck = new HashMap<String, List<ArtifactRepository>>();
|
||||
|
||||
// Process all the remote repositories.
|
||||
//
|
||||
|
@ -195,11 +196,13 @@ public class DefaultPluginPrefixResolver
|
|||
{
|
||||
if ( logger.isDebugEnabled() )
|
||||
{
|
||||
logger.warn( "Failed to retrieve " + remotePath + ": " + e.getMessage(), e );
|
||||
logger.warn( "Failed to retrieve " + remotePath + " from " + repository.getId() + ": "
|
||||
+ e.getMessage(), e );
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.warn( "Failed to retrieve " + remotePath + ": " + e.getMessage() );
|
||||
logger.warn( "Failed to retrieve " + remotePath + " from " + repository.getId() + ": "
|
||||
+ e.getMessage() );
|
||||
}
|
||||
}
|
||||
catch ( ArtifactDoesNotExistException e )
|
||||
|
@ -209,7 +212,13 @@ public class DefaultPluginPrefixResolver
|
|||
}
|
||||
else if ( !request.isOffline() && !request.isForceUpdate() )
|
||||
{
|
||||
recheck.add( repository );
|
||||
List<ArtifactRepository> repos = recheck.get( pluginGroup );
|
||||
if ( repos == null )
|
||||
{
|
||||
repos = new ArrayList<ArtifactRepository>();
|
||||
recheck.put( pluginGroup, repos );
|
||||
}
|
||||
repos.add( repository );
|
||||
}
|
||||
|
||||
PluginPrefixResult result = resolveFromRepository( request, pluginGroup, groupMetadataFile, repository );
|
||||
|
@ -225,7 +234,13 @@ public class DefaultPluginPrefixResolver
|
|||
//
|
||||
for ( String pluginGroup : request.getPluginGroups() )
|
||||
{
|
||||
for ( ArtifactRepository repository : recheck )
|
||||
List<ArtifactRepository> repos = recheck.get( pluginGroup );
|
||||
if ( repos == null )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for ( ArtifactRepository repository : repos )
|
||||
{
|
||||
String localPath = getLocalMetadataPath( pluginGroup, repository );
|
||||
|
||||
|
@ -241,11 +256,13 @@ public class DefaultPluginPrefixResolver
|
|||
{
|
||||
if ( logger.isDebugEnabled() )
|
||||
{
|
||||
logger.warn( "Failed to retrieve " + remotePath + ": " + e.getMessage(), e );
|
||||
logger.warn( "Failed to retrieve " + remotePath + " from " + repository.getId() + ": "
|
||||
+ e.getMessage(), e );
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.warn( "Failed to retrieve " + remotePath + ": " + e.getMessage() );
|
||||
logger.warn( "Failed to retrieve " + remotePath + " from " + repository.getId() + ": "
|
||||
+ e.getMessage() );
|
||||
}
|
||||
}
|
||||
catch ( ArtifactDoesNotExistException e )
|
||||
|
|
|
@ -128,11 +128,13 @@ public class DefaultPluginVersionResolver
|
|||
{
|
||||
if ( logger.isDebugEnabled() )
|
||||
{
|
||||
logger.warn( "Failed to retrieve " + remotePath + ": " + e.getMessage(), e );
|
||||
logger.warn( "Failed to retrieve " + remotePath + " from " + repository.getId() + ": "
|
||||
+ e.getMessage(), e );
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.warn( "Failed to retrieve " + remotePath + ": " + e.getMessage() );
|
||||
logger.warn( "Failed to retrieve " + remotePath + " from " + repository.getId() + ": "
|
||||
+ e.getMessage() );
|
||||
}
|
||||
|
||||
continue;
|
||||
|
|
Loading…
Reference in New Issue