correctly sort versions on artifact view

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1295024 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-02-29 09:14:28 +00:00
parent c772a05a6e
commit 9eb977f581
1 changed files with 9 additions and 3 deletions

View 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();