diff options
author | Brett Porter <brett@apache.org> | 2010-02-18 16:56:49 +0000 |
---|---|---|
committer | Brett Porter <brett@apache.org> | 2010-02-18 16:56:49 +0000 |
commit | 4231711a4086108df13e49c06d6d249dca99e61b (patch) | |
tree | a1383d5c99222bb7670f7b865c805cc691eb6797 | |
parent | 13d0e893b293443d5c9027cff59f92e9d4be5018 (diff) | |
download | archiva-4231711a4086108df13e49c06d6d249dca99e61b.tar.gz archiva-4231711a4086108df13e49c06d6d249dca99e61b.zip |
[MRM-1282] sort the results for platform independanceMRM-1025
git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/MRM-1025@911488 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolver.java | 18 |
1 files 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<String> rootNamespaces; + return getSortedFiles( dir, filter ); + } + + private static Collection<String> getSortedFiles( File dir, Filter<String> filter ) + { + List<String> fileNames; String[] files = dir.list( new DirectoryFilter( filter ) ); if ( files != null ) { - rootNamespaces = new ArrayList<String>( Arrays.asList( files ) ); - Collections.sort( rootNamespaces ); + fileNames = new ArrayList<String>( 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.<String>emptyList(); + return getSortedFiles( dir, filter ); } public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId, |