]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1282] sort the results for platform independance MRM-1025 MRM-1025
authorBrett Porter <brett@apache.org>
Thu, 18 Feb 2010 16:56:49 +0000 (16:56 +0000)
committerBrett Porter <brett@apache.org>
Thu, 18 Feb 2010 16:56:49 +0000 (16:56 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/MRM-1025@911488 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolver.java

index f4f6ce588c15017c5b061e318742fdee44a53693..168e3b1b5e7ed93d9f26d6a0e767505d0e8e1d36 100644 (file)
@@ -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,