diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java b/maven-compat/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java index 73989344a5..01cb0d76a5 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java @@ -30,8 +30,28 @@ import java.util.Properties; import java.util.Stack; /** - * Generic implementation of version comparison. + * Generic implementation of version comparison. Features: + * * + * @see "Versioning" on Maven Wiki * @author Kenney Westerhof * @author Herve Boutemy * @version $Id$ @@ -279,21 +299,21 @@ public class ComparableVersion case LIST_ITEM: Iterator left = iterator(); Iterator right = ( (ListItem) item ).iterator(); - + while ( left.hasNext() || right.hasNext() ) { Item l = left.hasNext() ? (Item) left.next() : null; Item r = right.hasNext() ? (Item) right.next() : null; - + // if this is shorter, then invert the compare and mul with -1 int result = l == null ? -1 * r.compareTo( l ) : l.compareTo( r ); - + if ( result != 0 ) { return result; } } - + return 0; default: @@ -370,7 +390,7 @@ public class ComparableVersion if ( isDigit ) { list.normalize(); // 1.0-* = 1-* - + if ( ( i + 1 < version.length() ) && Character.isDigit( version.charAt( i + 1 ) ) ) { // new ListItem only if previous were digits and new char is a digit,