mirror of https://github.com/apache/maven.git
Adding null checks for lists of artifacts before mapping them...now methods will simply return empty Map instances if null lists are passed in.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@225321 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
17991ceea7
commit
89371bb7fd
|
@ -54,12 +54,15 @@ public final class ArtifactUtils
|
||||||
{
|
{
|
||||||
Map artifactMap = new HashMap();
|
Map artifactMap = new HashMap();
|
||||||
|
|
||||||
|
if ( artifacts != null )
|
||||||
|
{
|
||||||
for ( Iterator it = artifacts.iterator(); it.hasNext(); )
|
for ( Iterator it = artifacts.iterator(); it.hasNext(); )
|
||||||
{
|
{
|
||||||
Artifact artifact = (Artifact) it.next();
|
Artifact artifact = (Artifact) it.next();
|
||||||
|
|
||||||
artifactMap.put( versionlessKey( artifact ), artifact );
|
artifactMap.put( versionlessKey( artifact ), artifact );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return artifactMap;
|
return artifactMap;
|
||||||
}
|
}
|
||||||
|
@ -68,12 +71,15 @@ public final class ArtifactUtils
|
||||||
{
|
{
|
||||||
Map artifactMap = new HashMap();
|
Map artifactMap = new HashMap();
|
||||||
|
|
||||||
|
if ( artifacts != null )
|
||||||
|
{
|
||||||
for ( Iterator it = artifacts.iterator(); it.hasNext(); )
|
for ( Iterator it = artifacts.iterator(); it.hasNext(); )
|
||||||
{
|
{
|
||||||
Artifact artifact = (Artifact) it.next();
|
Artifact artifact = (Artifact) it.next();
|
||||||
|
|
||||||
artifactMap.put( artifact.getId(), artifact );
|
artifactMap.put( artifact.getId(), artifact );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return artifactMap;
|
return artifactMap;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue