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
|
@ -53,12 +53,15 @@ public final class ArtifactUtils
|
|||
public static Map artifactMapByVersionlessId( Collection artifacts )
|
||||
{
|
||||
Map artifactMap = new HashMap();
|
||||
|
||||
for ( Iterator it = artifacts.iterator(); it.hasNext(); )
|
||||
|
||||
if ( artifacts != null )
|
||||
{
|
||||
Artifact artifact = (Artifact) it.next();
|
||||
for ( Iterator it = artifacts.iterator(); it.hasNext(); )
|
||||
{
|
||||
Artifact artifact = (Artifact) it.next();
|
||||
|
||||
artifactMap.put( versionlessKey( artifact ), artifact );
|
||||
artifactMap.put( versionlessKey( artifact ), artifact );
|
||||
}
|
||||
}
|
||||
|
||||
return artifactMap;
|
||||
|
@ -68,11 +71,14 @@ public final class ArtifactUtils
|
|||
{
|
||||
Map artifactMap = new HashMap();
|
||||
|
||||
for ( Iterator it = artifacts.iterator(); it.hasNext(); )
|
||||
if ( artifacts != null )
|
||||
{
|
||||
Artifact artifact = (Artifact) it.next();
|
||||
for ( Iterator it = artifacts.iterator(); it.hasNext(); )
|
||||
{
|
||||
Artifact artifact = (Artifact) it.next();
|
||||
|
||||
artifactMap.put( artifact.getId(), artifact );
|
||||
artifactMap.put( artifact.getId(), artifact );
|
||||
}
|
||||
}
|
||||
|
||||
return artifactMap;
|
||||
|
|
Loading…
Reference in New Issue