Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-6568

ComparableVersion breaks Comparable contract for some triples

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.3.9
    • None
    • None
    • Ubuntu en_GB.UTF-8, openjdk8.

    Description

      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

      % 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
      

      This is distinct from MNG-5568.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              faux Chris West (Faux)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: