You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Karl Heinz Marbaise (JIRA)" <ji...@apache.org> on 2018/07/31 18:53:00 UTC

[jira] [Comment Edited] (MNG-6420) ComparableVersion incorrectly parses certain version strings

    [ https://issues.apache.org/jira/browse/MNG-6420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16564194#comment-16564194 ] 

Karl Heinz Marbaise edited comment on MNG-6420 at 7/31/18 6:52 PM:
-------------------------------------------------------------------

The first thing which comes to my mind: What is correct: The docs or the code ? I currently would always tend to say the code is correct (which means we need to fix the docs accordingly). To be honest I don't see any chance currently to replace that code with something different cause the implications are to impossible to guess also if we assume the code has errors (Which I also tend to say; But related to what?)


was (Author: khmarbaise):
The first thing which comes to my mind: What is correct: The docs or the code ? I currently would always tend to say the code is correct. To be honest I don't see any chance currently to replace that code with something different cause the implications are to impossible to guess also if we assume the code has errors (Which I also tend to say; But related to what?)

> ComparableVersion incorrectly parses certain version strings
> ------------------------------------------------------------
>
>                 Key: MNG-6420
>                 URL: https://issues.apache.org/jira/browse/MNG-6420
>             Project: Maven
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.5.3
>            Reporter: Ross Goldberg
>            Priority: Major
>             Fix For: wontfix-candidate
>
>
> For certain version strings, ComparableVersion doesn't follow the Maven version order spec (https://maven.apache.org/pom.html#Version_Order_Specification).
> To improve the code & fix the following bugs, I completely rewrote the version parser (using Java 10 & Google Guava 25.1).  It is attached & passes all of the tests from ComparableVersionTest.
> Bug 1:
>  
> java -jar /usr/local/Cellar/maven/3.5.3/libexec/lib/maven-artifact-3.5.3.jar 1-0.3 1
>  
> Outputs:
>  
> 1. 1-0.3 == 1-0.3
>    1-0.3 == 1
> 2. 1 == 1
>  
> This probleem stems from:
>  
> [https://github.com/apache/maven/blob/b8c06e61ab73cd9e25a5b2c93d9e5077b2196751/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java#L295-L296]
>  
>  
>  
> Bug 2:
>  
> java -jar /usr/local/Cellar/maven/3.5.3/libexec/lib/maven-artifact-3.5.3.jar 1-0-2 1-0.1
>  
> 1. 1-0-2 == 1-2
>    1-0-2 < 1-0.1
> 2. 1-0.1 == 1-0.1
>  
> This problem stems from retaining ListItems that, after normalization, have no children other than the subsequent ListItem.  Removing the unnecessary ListItem should fix this (i.e. remove the extraneous ListItem (named extraneous) from its parent ListItem (named parent), then add the only child of extraneous to parent).



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