mirror of https://github.com/apache/maven.git
MNG-5638: Whitespaces matter in <mirrorOf> configuration can cause the incorrect repo to be selected
This commit is contained in:
parent
425c663584
commit
fddade227d
|
@ -89,6 +89,7 @@ public class DefaultMirrorSelector
|
|||
String[] repos = pattern.split( "," );
|
||||
for ( String repo : repos )
|
||||
{
|
||||
repo = repo.trim();
|
||||
// see if this is a negative match
|
||||
if ( repo.length() > 1 && repo.startsWith( "!" ) )
|
||||
{
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package org.apache.maven.repository;
|
||||
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.DefaultArtifactRepository;
|
||||
import org.codehaus.plexus.PlexusTestCase;
|
||||
|
||||
public class DefaultMirrorSelectorTest extends PlexusTestCase {
|
||||
|
||||
public void testMirrorWithMirroOfPatternContainingANegationIsNotSelected() {
|
||||
ArtifactRepository repository = new DefaultArtifactRepository("snapshots.repo", "http://whatever", null);
|
||||
String pattern = "external:*, !snapshots.repo";
|
||||
boolean matches = DefaultMirrorSelector.matchPattern(repository, pattern);
|
||||
System.out.println(matches);
|
||||
assertFalse(matches);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue