You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Chris West (Faux) (JIRA)" <ji...@apache.org> on 2019/01/18 23:15:00 UTC

[jira] [Created] (MNG-6568) ComparableVersion breaks Comparable contract for some triples

Chris West (Faux) created MNG-6568:
--------------------------------------

             Summary: ComparableVersion breaks Comparable contract for some triples
                 Key: MNG-6568
                 URL: https://issues.apache.org/jira/browse/MNG-6568
             Project: Maven
          Issue Type: Bug
          Components: Artifacts and Repositories
    Affects Versions: 3.3.9
         Environment: Ubuntu en_GB.UTF-8, openjdk8.
            Reporter: Chris West (Faux)


{{ComparableVersion}} breaks the {{Comparable}} contract for some triples, causing {{sort()}} to throw exceptions.

It believes "0-alpha" > "x", "x" > "0", and "0" > "0-alpha", which is an illegal cycle.

There are plenty of versions in central (across artifacts) that sort like this, e.g. https://search.maven.org/artifact/de.javakaffee.msm/memcached-session-manager-project/y/pom

{code}
% java -jar ~/.m2/repository/org/apache/maven/maven-artifact/3.3.9/maven-artifact-3.3.9.jar 0-alpha x 0 0-alpha
Display parameters as parsed by Maven (in canonical form) and comparison result:
1. 0-alpha == alpha
   0-alpha > x
2. x == x
   x > 0
3. 0 == 
   0 > 0-alpha
4. 0-alpha == alpha
{code}

This is distinct from MNG-5568.
 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)