NullPointerException inside
org.apache.maven.shared.artifact.filter.collection.AbstractArtifactFeatureFilter
------------------------------------------------------------------------------------------------------------
Key: MNG-3791
URL: http://jira.codehaus.org/browse/MNG-3791
Project: Maven 2
Issue Type: Bug
Affects Versions: 2.0.8
Reporter: Sascha Hofer
when using the profile shown below AbstractArtifactFeatureFilter (concrete
class: org.apache.maven.shared.artifact.filter.collection.ClassifierFilter)
encounters a NullPointerException when comparing an artifacts classifier with
one of the exclusion list.
This NPE happens because there are artifacts which simple have no classifier
and AbstractArtifactFeatureFilter.compareFeatures(String, String) simply
invokes <left string>.equals(<right string>).
In addition to this the stated NPE must already have been occured some time ago
because in
org.apache.maven.shared.artifact.filter.collection.FilterArtifacts.filter(Set)
it gets catched and ignored.
proposed fix in
org.apache.maven.shared.artifact.filter.collection.AbstractArtifactFeatureFilter:
/**
* Allows Feature comparison to be customized
*
* @param lhs String artifact's feature
* @param rhs String feature from exclude or include list
* @return boolean true if features match
*/
protected boolean compareFeatures( String lhs, String rhs )
{
if (lhs == null)
{
return rhs == null;
}
else
{
return ( lhs.equals( rhs ) );
}
}
part of the pom.xml which caused the error:
<profile>
<id>multi-module-coverage</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-dependencies</id>
<phase>process-classes</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
<excludeClassifiers>tests</excludeClassifiers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
--
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