mirror of
https://github.com/apache/archiva.git
synced 2025-03-01 14:09:08 +00:00
Sorting dependencies before comparison or hashCode calculation to side-step a bug that was fixed in maven 2.0.5 dealing with the sorting of dependencies as they are declared in the POM. Sorting will be restricted to temp variables in those methods to avoid changing behavior.
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@439314 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
bcfbb1f204
commit
16465609af
@ -1,5 +1,7 @@
|
||||
package org.apache.maven.archiva.indexer.record;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/*
|
||||
@ -174,10 +176,25 @@ public boolean equals( Object obj )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ( dependencies != null ? !dependencies.equals( that.dependencies ) : that.dependencies != null )
|
||||
|
||||
if ( dependencies != null && that.dependencies != null )
|
||||
{
|
||||
List sorted = new ArrayList( dependencies );
|
||||
Collections.sort( sorted );
|
||||
|
||||
List sortedOther = new ArrayList( that.dependencies );
|
||||
Collections.sort( sortedOther );
|
||||
|
||||
if ( !sorted.equals( sortedOther ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if ( !( dependencies == null && that.dependencies == null ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( developers != null ? !developers.equals( that.developers ) : that.developers != null )
|
||||
{
|
||||
return false;
|
||||
@ -247,7 +264,15 @@ public int hashCode()
|
||||
result = 31 * result + ( type != null ? type.hashCode() : 0 );
|
||||
result = 31 * result + ( files != null ? files.hashCode() : 0 );
|
||||
result = 31 * result + ( developers != null ? developers.hashCode() : 0 );
|
||||
result = 31 * result + ( dependencies != null ? dependencies.hashCode() : 0 );
|
||||
|
||||
if ( dependencies != null )
|
||||
{
|
||||
List sorted = new ArrayList( dependencies );
|
||||
Collections.sort( sorted );
|
||||
|
||||
result = 31 * result + sorted.hashCode();
|
||||
}
|
||||
|
||||
result = 31 * result + ( repository != null ? repository.hashCode() : 0 );
|
||||
result = 31 * result + ( packaging != null ? packaging.hashCode() : 0 );
|
||||
result = 31 * result + ( pluginPrefix != null ? pluginPrefix.hashCode() : 0 );
|
||||
|
Loading…
x
Reference in New Issue
Block a user