mirror of https://github.com/apache/maven.git
[MNG-3265] maven-model Extension.equals causes NPE when any field is uninitialized
o Merged from r793311 git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@793319 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d56f9e13bb
commit
c36b12739b
|
@ -3581,21 +3581,26 @@
|
|||
|
||||
Extension e = (Extension) o;
|
||||
|
||||
if ( !e.getArtifactId().equals( getArtifactId() ) )
|
||||
if ( !equal( e.getArtifactId(), getArtifactId() ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if ( !e.getGroupId().equals( getGroupId() ) )
|
||||
else if ( !equal( e.getGroupId(), getGroupId() ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if ( e.getVersion() != null ? !e.getVersion().equals( getVersion() ) : getVersion() != null )
|
||||
else if ( !equal( e.getVersion(), getVersion() ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static <T> boolean equal( T obj1, T obj2 )
|
||||
{
|
||||
return ( obj1 != null ) ? obj1.equals( obj2 ) : obj2 == null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
|
|
|
@ -39,6 +39,8 @@ public class ActivationFileTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new ActivationFile().equals( null ) );
|
||||
|
||||
new ActivationFile().equals( new ActivationFile() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class ActivationOSTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new ActivationOS().equals( null ) );
|
||||
|
||||
new ActivationOS().equals( new ActivationOS() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class ActivationPropertyTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new ActivationProperty().equals( null ) );
|
||||
|
||||
new ActivationProperty().equals( new ActivationProperty() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class ActivationTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new Activation().equals( null ) );
|
||||
|
||||
new Activation().equals( new Activation() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class BuildTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new Build().equals( null ) );
|
||||
|
||||
new Build().equals( new Build() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class CiManagementTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new CiManagement().equals( null ) );
|
||||
|
||||
new CiManagement().equals( new CiManagement() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class ContributorTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new Contributor().equals( null ) );
|
||||
|
||||
new Contributor().equals( new Contributor() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class DependencyManagementTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new DependencyManagement().equals( null ) );
|
||||
|
||||
new DependencyManagement().equals( new DependencyManagement() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class DependencyTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new Dependency().equals( null ) );
|
||||
|
||||
new Dependency().equals( new Dependency() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class DeploymentRepositoryTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new DeploymentRepository().equals( null ) );
|
||||
|
||||
new DeploymentRepository().equals( new DeploymentRepository() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class DeveloperTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new Developer().equals( null ) );
|
||||
|
||||
new Developer().equals( new Developer() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class DistributionManagementTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new DistributionManagement().equals( null ) );
|
||||
|
||||
new DistributionManagement().equals( new DistributionManagement() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class ExclusionTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new Exclusion().equals( null ) );
|
||||
|
||||
new Exclusion().equals( new Exclusion() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class ExtensionTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new Extension().equals( null ) );
|
||||
|
||||
new Extension().equals( new Extension() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class IssueManagementTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new IssueManagement().equals( null ) );
|
||||
|
||||
new IssueManagement().equals( new IssueManagement() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class LicenseTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new License().equals( null ) );
|
||||
|
||||
new License().equals( new License() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class MailingListTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new MailingList().equals( null ) );
|
||||
|
||||
new MailingList().equals( new MailingList() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class ModelTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new Model().equals( null ) );
|
||||
|
||||
new Model().equals( new Model() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class NotifierTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new Notifier().equals( null ) );
|
||||
|
||||
new Notifier().equals( new Notifier() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class OrganizationTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new Organization().equals( null ) );
|
||||
|
||||
new Organization().equals( new Organization() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class ParentTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new Parent().equals( null ) );
|
||||
|
||||
new Parent().equals( new Parent() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class PluginConfigurationTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new PluginConfiguration().equals( null ) );
|
||||
|
||||
new PluginConfiguration().equals( new PluginConfiguration() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class PluginContainerTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new PluginContainer().equals( null ) );
|
||||
|
||||
new PluginContainer().equals( new PluginContainer() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class PluginExecutionTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new PluginExecution().equals( null ) );
|
||||
|
||||
new PluginExecution().equals( new PluginExecution() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class PluginManagementTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new PluginManagement().equals( null ) );
|
||||
|
||||
new PluginManagement().equals( new PluginManagement() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class PluginTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new Plugin().equals( null ) );
|
||||
|
||||
new Plugin().equals( new Plugin() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class PrerequisitesTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new Prerequisites().equals( null ) );
|
||||
|
||||
new Prerequisites().equals( new Prerequisites() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class ProfileTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new Profile().equals( null ) );
|
||||
|
||||
new Profile().equals( new Profile() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class RelocationTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new Relocation().equals( null ) );
|
||||
|
||||
new Relocation().equals( new Relocation() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class ReportPluginTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new ReportPlugin().equals( null ) );
|
||||
|
||||
new ReportPlugin().equals( new ReportPlugin() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class ReportSetTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new ReportSet().equals( null ) );
|
||||
|
||||
new ReportSet().equals( new ReportSet() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class ReportingTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new Reporting().equals( null ) );
|
||||
|
||||
new Reporting().equals( new Reporting() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class RepositoryPolicyTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new RepositoryPolicy().equals( null ) );
|
||||
|
||||
new RepositoryPolicy().equals( new RepositoryPolicy() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class RepositoryTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new Repository().equals( null ) );
|
||||
|
||||
new Repository().equals( new Repository() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class ResourceTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new Resource().equals( null ) );
|
||||
|
||||
new Resource().equals( new Resource() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class ScmTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new Scm().equals( null ) );
|
||||
|
||||
new Scm().equals( new Scm() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
|
@ -39,6 +39,8 @@ public class SiteTest
|
|||
public void testEqualsNullSafe()
|
||||
{
|
||||
assertFalse( new Site().equals( null ) );
|
||||
|
||||
new Site().equals( new Site() );
|
||||
}
|
||||
|
||||
public void testEqualsIdentity()
|
||||
|
|
Loading…
Reference in New Issue