Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 3.37.0
-
Fix Version/s: 3.38.0
-
Labels:
-
Story Points:3
-
Release Note:Yes
-
Notability:2
-
InvestmentLayer:support-escalated
Description
SYMPTOM:
Sorting components with the Version column in web UI or REST API does not look like sorting with the alphabetical order. It looks like almost random.
REPRODUCE STEPS:
- Install NXRM 3.37.0
- mvn deploy with the following versions:
"7.10.0" "7.9.0" "SortTest-1.3.1" "SortTest-1.3.0" "SortTest-1.2.0" "SortTest-1.1.0" "SortTest-1.0.6" "SortTest-1.0.5" "SortTest-1.0.4" "SortTest-1.0.3" "SortTest-1.0.2" "SortTest.SR1" "SortTest"
- Login to the web UI and go to Browse => Maven, and search your uploaded components by typing the Group Id and Artifact Id, then click "Version" column to sort the list ascending order:
Users wouldn't be able to figure out what kind of order was used in above "Version" Ascending order.
EXPECTED:
It should sort with alpha-numeric order.
POTENTIAL CAUSE:
NEXUS-28918 introduced new sorting order which looks like populating the "normalized_version" field.
I'm suspecting the "normalized_version" values for "SortTest-x.y.z" may become same so that the list shown in UI becomes unpredictable order:
String[] strs = {"7.10.0","7.9.0","VersionTest-1.3.1","VersionTest-1.3.0","VersionTest-1.2.0", "VersionTest-1.1.0","VersionTest-1.0.6","VersionTest-1.0.5","VersionTest-1.0.4","VersionTest-1.0.3", "VersionTest-1.0.2","VersionTest.SR1","VersionTest"}; for(int i = 0; i< strs.length; i++){ System.out.println(strs[i] + " " + versionNormalizer.getNormalizedValue(strs[i])); }
Running above returns below:
7.10.0 000000007.000000010.000000000.c 7.9.0 000000007.000000009.000000000.c VersionTest-1.3.1 .000000000.000000000.e.versiontest-000000001 VersionTest-1.3.0 .000000000.000000000.e.versiontest-000000001 VersionTest-1.2.0 .000000000.000000000.e.versiontest-000000001 VersionTest-1.1.0 .000000000.000000000.e.versiontest-000000001 VersionTest-1.0.6 .000000000.000000000.e.versiontest-000000001 VersionTest-1.0.5 .000000000.000000000.e.versiontest-000000001 VersionTest-1.0.4 .000000000.000000000.e.versiontest-000000001 VersionTest-1.0.3 .000000000.000000000.e.versiontest-000000001 VersionTest-1.0.2 .000000000.000000000.e.versiontest-000000001 VersionTest.SR1 .000000000.000000000.e.sr-000000001 VersionTest .000000000.000000000.e.versiontest
This would be because the "splitQualifier" expects the version string should be "x.y.z-<Qualifier>" (like below), so that this returns "" (empty string) for the "version".
jshell> versionNormalizer.getNormalizedValue("1.3.1-VersionTest"); $15 ==> "000000001.000000003.000000001.e.versiontest"
Attachments
Issue Links
- is caused by
-
NEXUS-28918 Search API for maven format does not sort versions in the way Maven would expect
-
- Closed
-
- relates
-
NEXUS-31461 Unpredictable sort order for Maven versions
-
- New
-