[jboss-cvs] JBossAS SVN: r91122 - projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/virtual/spi.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jul 10 20:24:20 EDT 2009


Author: david.lloyd at jboss.com
Date: 2009-07-10 20:24:20 -0400 (Fri, 10 Jul 2009)
New Revision: 91122

Modified:
   projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/virtual/spi/ZipFileSystem.java
Log:
Zip files are indexed case-insensitively

Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/virtual/spi/ZipFileSystem.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/virtual/spi/ZipFileSystem.java	2009-07-11 00:15:36 UTC (rev 91121)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/virtual/spi/ZipFileSystem.java	2009-07-11 00:24:20 UTC (rev 91122)
@@ -72,7 +72,7 @@
       this.tempFileProvider = tempFileProvider;
       final ZipCatalog catalog = Zip.readCatalog(zipFile);
       final Collection<ZipEntry> entries = catalog.allEntries();
-      final ZipNode rootNode = new ZipNode(new HashMap<String, ZipNode>(), null);
+      final ZipNode rootNode = new ZipNode(new HashMap<String, ZipNode>(), null, "");
       FILES: for (ZipEntry zipEntry : entries)
       {
          final List<String> tokens = PathTokenizer.getTokens(zipEntry.getName());
@@ -86,11 +86,11 @@
                // todo - log bad zip entry
                continue FILES;
             }
-            ZipNode child = children.get(token);
+            ZipNode child = children.get(token.toLowerCase());
             if (child == null)
             {
-               child = it.hasNext() || zipEntry.getEntryType() == ZipEntryType.DIRECTORY ? new ZipNode(new HashMap<String, ZipNode>(), null) : new ZipNode(null, zipEntry);
-               children.put(token, child);
+               child = it.hasNext() || zipEntry.getEntryType() == ZipEntryType.DIRECTORY ? new ZipNode(new HashMap<String, ZipNode>(), null, token) : new ZipNode(null, zipEntry, token);
+               children.put(token.toLowerCase(), child);
             }
             node = child;
          }
@@ -229,18 +229,20 @@
    private static final class ZipNode {
       private final Map<String, ZipNode> children;
       private final ZipEntry entry;
+      private final String name;
       private volatile File cachedFile;
 
-      private ZipNode(Map<String, ZipNode> children, ZipEntry entry)
+      private ZipNode(Map<String, ZipNode> children, ZipEntry entry, String name)
       {
          this.children = children;
          this.entry = entry;
+         this.name = name;
       }
 
       private ZipNode find(Iterator<String> node) {
          if (node.hasNext())
          {
-            final ZipNode next = children.get(node.next());
+            final ZipNode next = children.get(node.next().toLowerCase());
             return next == null ? null : next.find(node);
          }
          else




More information about the jboss-cvs-commits mailing list