You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "John Casey (JIRA)" <ji...@codehaus.org> on 2007/02/22 03:22:27 UTC

[jira] Updated: (MASSEMBLY-180) A bug in artifact filtering ( maven-common-artifact-filters )

     [ http://jira.codehaus.org/browse/MASSEMBLY-180?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

John Casey updated MASSEMBLY-180:
---------------------------------

       Assignee: John Casey
    Description: 
I found this bug while using <includes> and <excludes> section in <dependencySet> element.
I had to check the source code to understand the "Advanced Artifact-Matching in includes and excludes". 
I found a bug in the project maven-common-artifact-filters, 1.0-alpha-1.
I checked the class PatternIncludesArtifactFilter, revision 487820. 
There is a bug in the method:
private boolean matchAgainst( String value, List patterns, boolean regionMatch ) 
There is an iteration of a list of patterns. When a pattern matches, the method should return true.
When no pattern matches, it should return false. 
However, when there is a pattern using a wildcard and this pattern does not match, the flow
will reach the line 216 where the method returns false.
Gotcha! the next patterns are not tried.... 
In other words, say we have :
<dependencySet>
...
<exclusions>
<exclusion>:jar:</exclusion>
</exclusion>:test-jar:</exclusion>
</exclusions>
...
</dependencySet> 
The effect of the bug is that the seconds pattern (:test-jar:) will not be used, because if matching of the first (:jar:) fails,
the method returns false, the next patterns is not used. 
I hope I clarified this issue.

  was:
I found this bug while using <includes> and <excludes> section in <dependencySet> element.
I had to check the source code to understand the "Advanced Artifact-Matching in includes and excludes".

I found a bug in the project maven-common-artifact-filters, 1.0-alpha-1.
I checked the class PatternIncludesArtifactFilter, revision 487820.

There is a bug in the method:
private boolean matchAgainst( String value, List patterns, boolean regionMatch )

There is an iteration of a list of patterns. When a pattern matches, the method should return true.
When no pattern matches, it should return false.

However, when there is a pattern using a wildcard (*) and this pattern does not match, the flow
will reach the line 216 where the method returns false.
Gotcha! the next patterns are not tried....

In other words, say we have :
<dependencySet>
...
<exclusions>
<exclusion>*:jar:*</exclusion>
</exclusion>*:test-jar:*</exclusion>
</exclusions>
...
</dependencySet>

The effect of the bug is that the seconds pattern (*:test-jar:*) will not be used, because if matching of the first (*:jar:*) fails,
the method returns false, the next patterns is not used.

I hope I clarified this issue.


> A bug in artifact filtering ( maven-common-artifact-filters )
> -------------------------------------------------------------
>
>                 Key: MASSEMBLY-180
>                 URL: http://jira.codehaus.org/browse/MASSEMBLY-180
>             Project: Maven 2.x Assembly Plugin
>          Issue Type: Bug
>    Affects Versions: 2.2
>            Reporter: Milos Volauf
>         Assigned To: John Casey
>
> I found this bug while using <includes> and <excludes> section in <dependencySet> element.
> I had to check the source code to understand the "Advanced Artifact-Matching in includes and excludes". 
> I found a bug in the project maven-common-artifact-filters, 1.0-alpha-1.
> I checked the class PatternIncludesArtifactFilter, revision 487820. 
> There is a bug in the method:
> private boolean matchAgainst( String value, List patterns, boolean regionMatch ) 
> There is an iteration of a list of patterns. When a pattern matches, the method should return true.
> When no pattern matches, it should return false. 
> However, when there is a pattern using a wildcard and this pattern does not match, the flow
> will reach the line 216 where the method returns false.
> Gotcha! the next patterns are not tried.... 
> In other words, say we have :
> <dependencySet>
> ...
> <exclusions>
> <exclusion>:jar:</exclusion>
> </exclusion>:test-jar:</exclusion>
> </exclusions>
> ...
> </dependencySet> 
> The effect of the bug is that the seconds pattern (:test-jar:) will not be used, because if matching of the first (:jar:) fails,
> the method returns false, the next patterns is not used. 
> I hope I clarified this issue.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira