From 4231711a4086108df13e49c06d6d249dca99e61b Mon Sep 17 00:00:00 2001 From: Brett Porter Date: Thu, 18 Feb 2010 16:56:49 +0000 Subject: [PATCH] [MRM-1282] sort the results for platform independance git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/MRM-1025@911488 13f79535-47bb-0310-9956-ffa450edef68 --- .../Maven2RepositoryMetadataResolver.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolver.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolver.java index f4f6ce588..168e3b1b5 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolver.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolver.java @@ -378,18 +378,23 @@ public class Maven2RepositoryMetadataResolver { File dir = getRepositoryBasedir( repoId ); - List rootNamespaces; + return getSortedFiles( dir, filter ); + } + + private static Collection getSortedFiles( File dir, Filter filter ) + { + List fileNames; String[] files = dir.list( new DirectoryFilter( filter ) ); if ( files != null ) { - rootNamespaces = new ArrayList( Arrays.asList( files ) ); - Collections.sort( rootNamespaces ); + fileNames = new ArrayList( Arrays.asList( files ) ); + Collections.sort( fileNames ); } else { - rootNamespaces = Collections.emptyList(); + fileNames = Collections.emptyList(); } - return rootNamespaces; + return fileNames; } private File getRepositoryBasedir( String repoId ) @@ -469,8 +474,7 @@ public class Maven2RepositoryMetadataResolver File dir = pathTranslator.toFile( getRepositoryBasedir( repoId ), namespace, projectId ); // all directories in a project directory can be considered a version - String[] files = dir.list( new DirectoryFilter( filter ) ); - return files != null ? Arrays.asList( files ) : Collections.emptyList(); + return getSortedFiles( dir, filter ); } public Collection getArtifacts( String repoId, String namespace, String projectId, -- 2.39.5