]> source.dussan.org Git - archiva.git/commitdiff
[MRM-694]
authorMaria Odea B. Ching <oching@apache.org>
Fri, 23 May 2008 03:49:59 +0000 (03:49 +0000)
committerMaria Odea B. Ching <oching@apache.org>
Fri, 23 May 2008 03:49:59 +0000 (03:49 +0000)
-fix index writer sorting for virtual repos

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@659397 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/util/IndexWriter.java

index 4854344a20defceda7a2a994e18e7433517c40db..439c7a47222ae66007b9021ed715c72b906db994 100644 (file)
@@ -125,7 +125,8 @@ public class IndexWriter
         else 
         {            
             // virtual repository - filter unique directories
-            Map<String, File> uniqueChildFiles = new HashMap<String, File>();                        
+            Map<String, File> uniqueChildFiles = new HashMap<String, File>();
+            List<String> sortedList = new ArrayList<String>();
             for( File resource : localResources )
             {
                 List<File> files = new ArrayList<File>( 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<File> uniqueChildFilesInList = new ArrayList<File>();
-            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 );
             }
         }
     }