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,7 +1109,11 @@ public void addMirror( String id,
ArtifactRepository mirror = new DefaultArtifactRepository( id, url, null ); ArtifactRepository mirror = new DefaultArtifactRepository( id, url, null );
mirrors.put( mirrorOf, mirror ); //to preserve first wins, don't add repeated mirrors.
if (!mirrors.containsKey( mirrorOf ))
{
mirrors.put( mirrorOf, mirror );
}
} }
public void setOnline( boolean online ) public void setOnline( boolean online )

View File

@ -585,6 +585,8 @@ public void testMirrorStopOnFirstMatch()
//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" );