From: Brett Porter Date: Thu, 18 Feb 2010 16:56:49 +0000 (+0000) Subject: [MRM-1282] sort the results for platform independance X-Git-Tag: archiva-1.4-M1~1017^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fremotes%2FMRM-1025;p=archiva.git [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 --- 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,