From: Maria Odea B. Ching Date: Fri, 23 May 2008 03:49:59 +0000 (+0000) Subject: [MRM-694] X-Git-Tag: archiva-r676265~114 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8b7e75cc71f80852c95d8c457165cd8b82a56e46;p=archiva.git [MRM-694] -fix index writer sorting for virtual repos git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@659397 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/util/IndexWriter.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/util/IndexWriter.java index 4854344a2..439c7a472 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/util/IndexWriter.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/util/IndexWriter.java @@ -125,7 +125,8 @@ public class IndexWriter else { // virtual repository - filter unique directories - Map uniqueChildFiles = new HashMap(); + Map uniqueChildFiles = new HashMap(); + List sortedList = new ArrayList(); for( File resource : localResources ) { List files = new ArrayList( Arrays.asList( resource.listFiles() ) ); @@ -135,17 +136,15 @@ public class IndexWriter if( uniqueChildFiles.get( file.getName() ) == null ) { uniqueChildFiles.put( file.getName(), file ); + sortedList.add( file.getName() ); } } } - - List uniqueChildFilesInList = new ArrayList(); - uniqueChildFilesInList.addAll( uniqueChildFiles.values() ); - Collections.sort( uniqueChildFilesInList ); - - for ( File file : uniqueChildFilesInList ) - { - writeHyperlink( writer, file.getName(), file.isDirectory(), true ); + + Collections.sort( sortedList ); + for ( String fileName : sortedList ) + { + writeHyperlink( writer, fileName, ( (File) uniqueChildFiles.get( fileName ) ).isDirectory(), true ); } } }