summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaria Odea B. Ching <oching@apache.org>2008-05-23 03:49:59 +0000
committerMaria Odea B. Ching <oching@apache.org>2008-05-23 03:49:59 +0000
commit8b7e75cc71f80852c95d8c457165cd8b82a56e46 (patch)
treed5e9c4ad4a88a1e2a2e7a00db29c38cdfeda6457
parent1c2d13c01c62b56f44041694fe9505f9b543e883 (diff)
downloadarchiva-8b7e75cc71f80852c95d8c457165cd8b82a56e46.tar.gz
archiva-8b7e75cc71f80852c95d8c457165cd8b82a56e46.zip
[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
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/util/IndexWriter.java17
1 files 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<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 );
}
}
}