Index: src/test/java/org/apache/maven/artifact/resolver/filter/ExcludesArtifactFilterTest.java
===================================================================
--- src/test/java/org/apache/maven/artifact/resolver/filter/ExcludesArtifactFilterTest.java	(revision 0)
+++ src/test/java/org/apache/maven/artifact/resolver/filter/ExcludesArtifactFilterTest.java	(revision 0)
@@ -0,0 +1,266 @@
+package org.apache.maven.artifact.resolver.filter;
+
+import java.util.Arrays;
+
+import junit.framework.TestCase;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.artifact.versioning.VersionRange;
+
+/**
+ * @author <a href="mailto:tomek.bujok@gmail.com">Tomasz Bujok</a>
+ */
+public class ExcludesArtifactFilterTest
+    extends TestCase
+{
+
+    private String getPattern( String groupId, String artifactId )
+    {
+        return groupId + ":" + artifactId;
+    }
+
+    private Artifact createSampleArtifact( String groupId, String artifactId )
+    {
+        VersionRange range = VersionRange.createFromVersion( "1.0" );
+        return new DefaultArtifact( groupId, artifactId, range, "scope", "type", "classifier", null );
+    }
+
+    public void testExcludeAllScenario1()
+    {
+        String groupId = null;
+        String artifactId = null;
+        String[] patterns = new String[] { getPattern( groupId, artifactId ) };
+        ExcludesArtifactFilter exclusionFilter = new ExcludesArtifactFilter( Arrays.asList( patterns ) );
+        assertFalse( exclusionFilter.isExcludeAll() );
+    }
+
+    public void testExcludeAllScenario2()
+    {
+        String groupId = "";
+        String artifactId = null;
+        String[] patterns = new String[] { getPattern( groupId, artifactId ) };
+        ExcludesArtifactFilter exclusionFilter = new ExcludesArtifactFilter( Arrays.asList( patterns ) );
+        assertFalse( exclusionFilter.isExcludeAll() );
+    }
+
+    public void testExcludeAllScenario3()
+    {
+        String groupId = "\t";
+        String artifactId = "   ";
+        String[] patterns = new String[] { getPattern( groupId, artifactId ) };
+        ExcludesArtifactFilter exclusionFilter = new ExcludesArtifactFilter( Arrays.asList( patterns ) );
+        assertFalse( exclusionFilter.isExcludeAll() );
+    }
+
+    public void testExcludeAllScenario4()
+    {
+        String groupId = null;
+        String artifactId = "*";
+        String[] patterns = new String[] { getPattern( groupId, artifactId ) };
+        ExcludesArtifactFilter exclusionFilter = new ExcludesArtifactFilter( Arrays.asList( patterns ) );
+        assertTrue( exclusionFilter.isExcludeAll() );
+    }
+
+    public void testExcludeAllScenario5()
+    {
+        String groupId = null;
+        String artifactId = "*\t\n";
+        String[] patterns = new String[] { getPattern( groupId, artifactId ) };
+        ExcludesArtifactFilter exclusionFilter = new ExcludesArtifactFilter( Arrays.asList( patterns ) );
+        assertTrue( exclusionFilter.isExcludeAll() );
+    }
+
+    public void testExcludeAllScenario6()
+    {
+        String groupId = null;
+        String artifactId = "**";
+        String[] patterns = new String[] { getPattern( groupId, artifactId ) };
+        ExcludesArtifactFilter exclusionFilter = new ExcludesArtifactFilter( Arrays.asList( patterns ) );
+        assertTrue( exclusionFilter.isExcludeAll() );
+    }
+
+    public void testExcludeAllScenario7()
+    {
+        String groupId = "*";
+        String artifactId = null;
+        String[] patterns = new String[] { getPattern( groupId, artifactId ) };
+        ExcludesArtifactFilter exclusionFilter = new ExcludesArtifactFilter( Arrays.asList( patterns ) );
+        assertTrue( exclusionFilter.isExcludeAll() );
+    }
+
+    public void testExcludeAllScenario8()
+    {
+        String groupId = "*";
+        String artifactId = "commons-logging";
+        String[] patterns = new String[] { getPattern( groupId, artifactId ) };
+        ExcludesArtifactFilter exclusionFilter = new ExcludesArtifactFilter( Arrays.asList( patterns ) );
+        assertFalse( exclusionFilter.isExcludeAll() );
+    }
+
+    public void testWildcardExcludeScenario1()
+    {
+        String groupId = null;
+        String artifactId = "commons-logging";
+        String[] patterns = new String[] { getPattern( groupId, artifactId ) };
+        ExcludesArtifactFilter exclusionFilter = new ExcludesArtifactFilter( Arrays.asList( patterns ) );
+        
+        Artifact artifact = createSampleArtifact("org.apache.commons", "commons-logging");
+        assertFalse( exclusionFilter.include( artifact ) );
+    }
+
+    public void testWildcardExcludeScenario2()
+    {
+        String groupId = "org.apache.commons";
+        String artifactId = null;
+        String[] patterns = new String[] { getPattern( groupId, artifactId ) };
+        ExcludesArtifactFilter exclusionFilter = new ExcludesArtifactFilter( Arrays.asList( patterns ) );
+        
+        Artifact artifact = createSampleArtifact("org.apache.commons", "commons-logging");
+        assertFalse( exclusionFilter.include( artifact ) );
+    }
+
+    public void testWildcardExcludeScenario3()
+    {
+        String groupId = "org.apache.*";
+        String artifactId = null;
+        String[] patterns = new String[] { getPattern( groupId, artifactId ) };
+        ExcludesArtifactFilter exclusionFilter = new ExcludesArtifactFilter( Arrays.asList( patterns ) );
+        
+        Artifact artifact = createSampleArtifact("org.apache.commons", "commons-logging");
+        assertFalse( exclusionFilter.include( artifact ) );
+    }
+
+    public void testWildcardExcludeScenario4()
+    {
+        String groupId = "org.apa*";
+        String artifactId = null;
+        String[] patterns = new String[] { getPattern( groupId, artifactId ) };
+        ExcludesArtifactFilter exclusionFilter = new ExcludesArtifactFilter( Arrays.asList( patterns ) );
+        
+        Artifact artifact = createSampleArtifact("org.apache.commons", "commons-logging");
+        assertFalse( exclusionFilter.include( artifact ) );
+    }
+
+    public void testWildcardExcludeScenario5()
+    {
+        String groupId = "*";
+        String artifactId = null;
+        String[] patterns = new String[] { getPattern( groupId, artifactId ) };
+        ExcludesArtifactFilter exclusionFilter = new ExcludesArtifactFilter( Arrays.asList( patterns ) );
+        
+        Artifact artifact = createSampleArtifact("org.apache.commons", "commons-logging");
+        assertFalse( exclusionFilter.include( artifact ) );
+    }
+
+    public void testWildcardExcludeScenario6()
+    {
+        // groupId beginning with the dot
+        String groupId = ".*";
+        String artifactId = null;
+        String[] patterns = new String[] { getPattern( groupId, artifactId ) };
+        ExcludesArtifactFilter exclusionFilter = new ExcludesArtifactFilter( Arrays.asList( patterns ) );
+        
+        Artifact artifact = createSampleArtifact("org.apache.commons", "commons-logging");
+        assertTrue( exclusionFilter.include( artifact ) );
+    }
+
+    public void testWildcardExcludeScenario7()
+    {
+        String groupId = "org.*.commons";
+        String artifactId = null;
+        String[] patterns = new String[] { getPattern( groupId, artifactId ) };
+        ExcludesArtifactFilter exclusionFilter = new ExcludesArtifactFilter( Arrays.asList( patterns ) );
+        
+        Artifact artifact = createSampleArtifact("org.apache.commons", "commons-logging");
+        assertFalse( exclusionFilter.include( artifact ) );
+        
+        Artifact artifact2 = createSampleArtifact("org.test.commons", "test-commons");
+        assertFalse( exclusionFilter.include( artifact2 ) );
+    }
+
+    public void testWildcardExcludeScenario8()
+    {
+        String groupId = "*ns";
+        String artifactId = null;
+        String[] patterns = new String[] { getPattern( groupId, artifactId ) };
+        ExcludesArtifactFilter exclusionFilter = new ExcludesArtifactFilter( Arrays.asList( patterns ) );
+        
+        Artifact artifact = createSampleArtifact("org.apache.commons", "commons-logging");
+        assertFalse( exclusionFilter.include( artifact ) );
+        
+        Artifact artifact2 = createSampleArtifact("org.test.commons", "test-commons");
+        assertFalse( exclusionFilter.include( artifact2 ) );
+    }
+
+    public void testWildcardExcludeScenario9()
+    {
+        String groupId = null;
+        String artifactId = "*commons*";
+        String[] patterns = new String[] { getPattern( groupId, artifactId ) };
+        ExcludesArtifactFilter exclusionFilter = new ExcludesArtifactFilter( Arrays.asList( patterns ) );
+        
+        Artifact artifact = createSampleArtifact("org.apache.commons", "commons-logging");
+        assertFalse( exclusionFilter.include( artifact ) );
+        
+        Artifact artifact2 = createSampleArtifact("org.test.commons", "test-commons");
+        assertFalse( exclusionFilter.include( artifact2 ) );
+    }
+    
+    public void testWildcardExcludeScenario10()
+    {
+        String groupId = null;
+        String artifactId = "*commons";
+        String[] patterns = new String[] { getPattern( groupId, artifactId ) };
+        ExcludesArtifactFilter exclusionFilter = new ExcludesArtifactFilter( Arrays.asList( patterns ) );
+        
+        Artifact artifact = createSampleArtifact("org.apache.commons", "commons-logging");
+        assertTrue( exclusionFilter.include( artifact ) );
+        
+        Artifact artifact2 = createSampleArtifact("org.test.commons", "test-commons");
+        assertFalse( exclusionFilter.include( artifact2 ) );
+    }
+    
+    public void testWildcardExcludeScenario11()
+    {
+        String groupId = null;
+        String artifactId = "commons*";
+        String[] patterns = new String[] { getPattern( groupId, artifactId ) };
+        ExcludesArtifactFilter exclusionFilter = new ExcludesArtifactFilter( Arrays.asList( patterns ) );
+        
+        Artifact artifact = createSampleArtifact("org.apache.commons", "commons-logging");
+        assertFalse( exclusionFilter.include( artifact ) );
+        
+        Artifact artifact2 = createSampleArtifact("org.test.commons", "test-commons");
+        assertTrue( exclusionFilter.include( artifact2 ) );
+    }
+    
+    public void testWildcardExcludeScenario12()
+    {
+        String groupId = null;
+        String artifactId = "***commons**";
+        String[] patterns = new String[] { getPattern( groupId, artifactId ) };
+        ExcludesArtifactFilter exclusionFilter = new ExcludesArtifactFilter( Arrays.asList( patterns ) );
+        
+        Artifact artifact = createSampleArtifact("org.apache.commons", "commons-logging");
+        assertFalse( exclusionFilter.include( artifact ) );
+        
+        Artifact artifact2 = createSampleArtifact("org.test.commons", "test-commons");
+        assertFalse( exclusionFilter.include( artifact2 ) );
+    }
+    
+    public void testWildcardExcludeScenario13()
+    {
+        String groupId = null;
+        String artifactId = "commons";
+        String[] patterns = new String[] { getPattern( groupId, artifactId ) };
+        ExcludesArtifactFilter exclusionFilter = new ExcludesArtifactFilter( Arrays.asList( patterns ) );
+        
+        Artifact artifact = createSampleArtifact("org.apache.commons", "commons-logging");
+        assertTrue( exclusionFilter.include( artifact ) );
+        
+        Artifact artifact2 = createSampleArtifact("org.test.commons", "test-commons");
+        assertTrue( exclusionFilter.include( artifact2 ) );
+    }
+
+}

Property changes on: src\test\java\org\apache\maven\artifact\resolver\filter\ExcludesArtifactFilterTest.java
___________________________________________________________________
Added: bugtraq:label
   + Bug-ID
Added: bugtraq:url
   + http://www.wp.pl
Added: bugtraq:message
   + %BUGID%
Added: svn:mime-type
   + text/plain
Added: bugtraq:number
   + yes

Index: src/main/java/org/apache/maven/artifact/resolver/filter/ExcludesArtifactFilter.java
===================================================================
--- src/main/java/org/apache/maven/artifact/resolver/filter/ExcludesArtifactFilter.java	(revision 790602)
+++ src/main/java/org/apache/maven/artifact/resolver/filter/ExcludesArtifactFilter.java	(working copy)
@@ -19,27 +19,159 @@
  * under the License.
  */
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
 import org.apache.maven.artifact.Artifact;
 
-import java.util.List;
-
 /**
- * Filter to exclude from a list of artifact patterns.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- * @version $Id$
- * @todo I think this is equiv. to exclusion set filter in maven-core
+ * Wild-card exclusion filter for artifact dependencies<br>
+ * Filter constructs literal java regular expression for every pattern which is contained by the list passed to the
+ * filter constructor. Include method matches given artifact against all patterns. Since it is an exlcusion filter - if
+ * artifact is matched at least once it will not be included. Filter defines "*" (star) as a wild-card character - a
+ * character that may be substituted for any other character(s). It is implemented in such a way, that every occurrence
+ * of a "*" (star) in the exclusion pattern is replaced with the ".*" expression during the construction of the literal
+ * java regex. Exclusion pattern can contain wild-card character zero or more times in any place in the groupId or
+ * artifactId;
+ * 
+ * @author <a href="mailto:tomek.bujok@gmail.com">Tomasz Bujok</a>
  */
 public class ExcludesArtifactFilter
-    extends IncludesArtifactFilter
+    implements ArtifactFilter
 {
+
+    private final List<Pattern> patterns;
+
+    private static final String TOKEN_DELIMITER = ":";
+
+    private static final String WILDCARD_TOKEN = ".*";
+
+    private static final String SHORT_WILDCARD_TOKEN = "*";
+
+    private static final String NULL_STRING = "null";
+
+    private static final String GLOBAL_WILDCARD = WILDCARD_TOKEN + TOKEN_DELIMITER + WILDCARD_TOKEN;
+
+    private boolean excludeAll;
+
+    /**
+     * Returns literal regular expression constructed from the given exclusion pattern (which can contain defined
+     * wild-card character "*")
+     * 
+     * @param pattern Exclusion pattern in the following format: "groupId:artifactId". Exclusion pattern can contain
+     *            defined wild-card character "*" in any place in the groupId or artifactId string;
+     * @return literal regular expression constructed from the given exclusion pattern or null if the construction fails
+     *         or no regular expression can be constructed from the given input
+     */
+    private String prepareRegex( String pattern )
+    {
+        // split pattern to get groupId and artifactId tokens
+        String patternTokens[] = pattern.split( TOKEN_DELIMITER );
+        int nullCount = 0;
+        for ( int i = 0; i < patternTokens.length; i++ )
+        {
+            // remove white characters from the token
+            patternTokens[i] = patternTokens[i].trim();
+            // replace empty token (null, "null" or "") with the wild-card token ".*"
+            if ( patternTokens[i] == null || NULL_STRING.equals( patternTokens[i] ) || patternTokens[i].isEmpty() )
+            {
+                patternTokens[i] = WILDCARD_TOKEN;
+                nullCount++;
+            }
+            else
+            {
+                // simplify pattern by removing redundant wild-card characters which stand in a row
+                patternTokens[i].replaceAll( String.format( "(//%s)+", SHORT_WILDCARD_TOKEN ), SHORT_WILDCARD_TOKEN );
+                boolean tokenEndsWithWildcard = patternTokens[i].endsWith( SHORT_WILDCARD_TOKEN );
+                // split token around wild-card character - in order not to quote the wild-card character
+                String tokenElements[] = patternTokens[i].split( Pattern.quote( SHORT_WILDCARD_TOKEN ) );
+                StringBuilder tokenBuilder = new StringBuilder();
+                // construct java regex for the whole token
+                for ( int j = 0; j < tokenElements.length; j++ )
+                {
+                    // quote every token element to create literal java regex
+                    tokenBuilder.append( Pattern.quote( tokenElements[j] ) );
+                    // insert literal java regex wildcard ".*" in place of the wild-card character "*"
+                    if ( j < tokenElements.length - 1 )
+                        tokenBuilder.append( WILDCARD_TOKEN );
+                }
+                // insert trailing wildcard token - if required
+                if ( tokenEndsWithWildcard )
+                    tokenBuilder.append( WILDCARD_TOKEN );
+                // return constructed token
+                patternTokens[i] = tokenBuilder.toString();
+            }
+        }
+        // all tokens (groupId and artifactId) were empty strings - return null since we don't want a global wild-card
+        // in such case
+        if ( nullCount == patternTokens.length )
+            return null;
+        // return concatenation of the literal java regular expressions constructed for each token
+        return patternTokens[0] + TOKEN_DELIMITER + patternTokens[1];
+    }
+
+    @SuppressWarnings( "unchecked" )
     public ExcludesArtifactFilter( List patterns )
     {
-        super( patterns );
+        this.patterns = new ArrayList<Pattern>( patterns.size() );
+        for ( String pattern : (List<String>) patterns )
+        {
+            try
+            {
+                // construct literal java regex for each pattern
+                String regex = prepareRegex( pattern );
+                if ( regex != null )
+                {
+                    // if regex is a global wildcard regex (.*:.*) clear pattern list, and initialize excludeAll flag
+                    // for performance optimization
+                    if ( regex.equals( GLOBAL_WILDCARD ) )
+                    {
+                        this.excludeAll = true;
+                        this.patterns.clear();
+                        break;
+                    }
+                    // compile pattern using regex and add it to the patterns list
+                    else
+                        this.patterns.add( Pattern.compile( regex ) );
+                }
+            }
+            catch ( PatternSyntaxException ex )
+            {
+                // skip intentionally since model parsing and validation succeeded
+                // pattern will be disabled, but no exception will be escalated
+            }
+        }
     }
 
     public boolean include( Artifact artifact )
     {
-        return !super.include( artifact );
+        if ( excludeAll )
+        {
+            return false;
+        }
+        else
+        {
+            String artifactId = artifact.getGroupId() + TOKEN_DELIMITER + artifact.getArtifactId();
+            // match artifact against all patterns
+            for ( Pattern pattern : this.patterns )
+            {
+                // since it is a exlcusion filter - if artifact is matched - it will not be included
+                if ( pattern.matcher( artifactId ).matches() )
+                    return false;
+            }
+            // return true - artifact was not matched
+            return true;
+        }
     }
+
+    /**
+     * @return true if filter excludes all artifacts using global wildcard which matches all possible artifacts
+     */
+    public boolean isExcludeAll()
+    {
+        return excludeAll;
+    }
+
 }

