MNG-3974 - stop on first mirror pattern match (fix to handle repeated entires)

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@733071 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brian E Fox 2009-01-09 15:50:31 +00:00
parent 6034e26622
commit 9c7e082906
2 changed files with 7 additions and 1 deletions

View File

@ -1109,8 +1109,12 @@ public class DefaultWagonManager
ArtifactRepository mirror = new DefaultArtifactRepository( id, url, null ); ArtifactRepository mirror = new DefaultArtifactRepository( id, url, null );
//to preserve first wins, don't add repeated mirrors.
if (!mirrors.containsKey( mirrorOf ))
{
mirrors.put( mirrorOf, mirror ); mirrors.put( mirrorOf, mirror );
} }
}
public void setOnline( boolean online ) public void setOnline( boolean online )
{ {

View File

@ -585,6 +585,8 @@ public class DefaultWagonManagerTest
//exact matches win first //exact matches win first
wagonManager.addMirror( "a2", "a,b", "http://a2" ); wagonManager.addMirror( "a2", "a,b", "http://a2" );
wagonManager.addMirror( "a", "a", "http://a" ); wagonManager.addMirror( "a", "a", "http://a" );
//make sure repeated entries are skipped
wagonManager.addMirror( "a", "a", "http://a3" );
wagonManager.addMirror( "b", "b", "http://b" ); wagonManager.addMirror( "b", "b", "http://b" );
wagonManager.addMirror( "c", "d,e", "http://de" ); wagonManager.addMirror( "c", "d,e", "http://de" );