[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
This commit is contained in:
Brett Porter 2010-02-18 16:56:49 +00:00
parent 13d0e893b2
commit 4231711a40
1 changed files with 11 additions and 7 deletions

View 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,