From 637c0f815bcb9ba7c5232a517415c8f3e2e5ef04 Mon Sep 17 00:00:00 2001 From: Brett Leslie Porter Date: Mon, 9 May 2005 12:42:04 +0000 Subject: [PATCH] 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 --- .../metadata/ReleaseArtifactMetadata.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/metadata/ReleaseArtifactMetadata.java b/maven-artifact/src/main/java/org/apache/maven/artifact/metadata/ReleaseArtifactMetadata.java index 06067f3c80..2da6516ba0 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/metadata/ReleaseArtifactMetadata.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/metadata/ReleaseArtifactMetadata.java @@ -47,6 +47,7 @@ public class ReleaseArtifactMetadata { ReleaseArtifactMetadata metadata = (ReleaseArtifactMetadata) o; + // TODO: we need some more complicated version comparison if ( version == null ) { if ( metadata.version == null ) @@ -58,9 +59,17 @@ public class ReleaseArtifactMetadata return -1; } } - - // TODO: we need some more complicated version comparison - return version.compareTo( metadata.version ); + else + { + if ( metadata.version == null ) + { + return 1; + } + else + { + return version.compareTo( metadata.version ); + } + } } public boolean newerThanFile( File file )