fix bug in compareTo when metadata.version is null

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@169306 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-05-09 12:42:04 +00:00
parent 05affa0a65
commit 637c0f815b
1 changed files with 12 additions and 3 deletions

View File

@ -47,6 +47,7 @@ public class ReleaseArtifactMetadata
{ {
ReleaseArtifactMetadata metadata = (ReleaseArtifactMetadata) o; ReleaseArtifactMetadata metadata = (ReleaseArtifactMetadata) o;
// TODO: we need some more complicated version comparison
if ( version == null ) if ( version == null )
{ {
if ( metadata.version == null ) if ( metadata.version == null )
@ -58,9 +59,17 @@ public class ReleaseArtifactMetadata
return -1; return -1;
} }
} }
else
// TODO: we need some more complicated version comparison {
return version.compareTo( metadata.version ); if ( metadata.version == null )
{
return 1;
}
else
{
return version.compareTo( metadata.version );
}
}
} }
public boolean newerThanFile( File file ) public boolean newerThanFile( File file )