]> source.dussan.org Git - archiva.git/commitdiff
correctly sort versions on artifact view
authorOlivier Lamy <olamy@apache.org>
Wed, 29 Feb 2012 09:14:28 +0000 (09:14 +0000)
committerOlivier Lamy <olamy@apache.org>
Wed, 29 Feb 2012 09:14:28 +0000 (09:14 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1295024 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java

index c6f2d78692036757a13bf633f0f03dcb6ffed6af..c98fdab69fbdf289b0de7dd19aaf63c034d1715e 100644 (file)
@@ -18,6 +18,7 @@ package org.apache.archiva.rest.services;
  * under the License.
  */
 
+import org.apache.archiva.common.utils.VersionComparator;
 import org.apache.archiva.metadata.model.ProjectVersionMetadata;
 import org.apache.archiva.metadata.repository.MetadataResolutionException;
 import org.apache.archiva.metadata.repository.MetadataResolver;
@@ -185,7 +186,7 @@ public class DefaultBrowseService
 
     }
 
-    private Set<String> getVersions( List<String> selectedRepos, String groupId, String artifactId )
+    private Collection<String> getVersions( List<String> selectedRepos, String groupId, String artifactId )
         throws MetadataResolutionException
 
     {
@@ -202,7 +203,12 @@ public class DefaultBrowseService
                     metadataResolver.resolveProjectVersions( repositorySession, repoId, groupId, artifactId ) );
             }
 
-            return versions;
+            List<String> sortedVersions = new ArrayList<String>( versions );
+
+            Collections.sort( sortedVersions, VersionComparator.getInstance() );
+
+
+            return sortedVersions;
         }
         finally
         {
@@ -226,7 +232,7 @@ public class DefaultBrowseService
         try
         {
 
-            Set<String> projectVersions = getVersions( selectedRepos, groupId, artifactId );
+            Collection<String> projectVersions = getVersions( selectedRepos, groupId, artifactId );
 
             repositorySession = repositorySessionFactory.createSession();