mirror of https://github.com/apache/maven.git
make versions with 4 or more parts be treated as string comparisons
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@219823 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b8f9148724
commit
64836b2555
|
@ -99,7 +99,7 @@ public class DefaultArtifactVersion
|
|||
|
||||
private int compareIntegers( Integer i1, Integer i2 )
|
||||
{
|
||||
if ( i1 == i2 )
|
||||
if ( i1 == null ? i2 == null : i1.equals( i2 ) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -197,6 +197,14 @@ public class DefaultArtifactVersion
|
|||
{
|
||||
incrementalVersion = Integer.valueOf( tok.nextToken() );
|
||||
}
|
||||
if ( tok.hasMoreTokens() )
|
||||
{
|
||||
// qualifier is the whole version, including "-"
|
||||
qualifier = version;
|
||||
majorVersion = null;
|
||||
minorVersion = null;
|
||||
incrementalVersion = null;
|
||||
}
|
||||
}
|
||||
catch ( NumberFormatException e )
|
||||
{
|
||||
|
|
|
@ -98,6 +98,13 @@ public class DefaultArtifactVersionTest
|
|||
assertEquals( "check incremental version", 0, version.getIncrementalVersion() );
|
||||
assertEquals( "check build number", 0, version.getBuildNumber() );
|
||||
assertEquals( "check qualifier", "1.0RC2", version.getQualifier() );
|
||||
|
||||
version = new DefaultArtifactVersion( "1.7.3.0" );
|
||||
assertEquals( "check major version", 0, version.getMajorVersion() );
|
||||
assertEquals( "check minor version", 0, version.getMinorVersion() );
|
||||
assertEquals( "check incremental version", 0, version.getIncrementalVersion() );
|
||||
assertEquals( "check build number", 0, version.getBuildNumber() );
|
||||
assertEquals( "check qualifier", "1.7.3.0", version.getQualifier() );
|
||||
}
|
||||
|
||||
public void testVersionComparing()
|
||||
|
|
Loading…
Reference in New Issue