From 8b7e75cc71f80852c95d8c457165cd8b82a56e46 Mon Sep 17 00:00:00 2001 From: "Maria Odea B. Ching" Date: Fri, 23 May 2008 03:49:59 +0000 Subject: [PATCH] [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 --- .../maven/archiva/webdav/util/IndexWriter.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) 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 ); } } } -- 2.39.5