[jboss-cvs] JBossAS SVN: r75184 - projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Jun 29 17:09:38 EDT 2008


Author: mstruk
Date: 2008-06-29 17:09:38 -0400 (Sun, 29 Jun 2008)
New Revision: 75184

Modified:
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipEntryContext.java
Log:
Nested dir serialization issue

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipEntryContext.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipEntryContext.java	2008-06-29 20:58:50 UTC (rev 75183)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipEntryContext.java	2008-06-29 21:09:38 UTC (rev 75184)
@@ -221,8 +221,14 @@
       setRootPeer(peer);
 
       String name = getRootURI().toString();
-      int toPos = name.length();
 
+      // cut off query string
+      int toPos = name.lastIndexOf("?");
+      if (toPos != -1)
+         name = name.substring(0, toPos);
+
+      toPos = name.length();
+
       // cut off any ending slash
       if(name.length() != 0 && name.charAt(name.length()-1) == '/')
          toPos --;
@@ -299,7 +305,7 @@
     * @return zip wrapper instance
     * @throws IOException for any error
     */
-   protected static ZipWrapper findEntry(InputStream is, String relative) throws IOException
+   protected ZipWrapper findEntry(InputStream is, String relative) throws IOException
    {
       ByteArrayOutputStream baos = new ByteArrayOutputStream();
       ZipEntryContext.copyStreamAndClose(is, baos);
@@ -321,11 +327,18 @@
             if (match.equals(relative))
             {
                if (entry.isDirectory())
+               {
+                  this.rootEntryPath = relative;
                   return new ZipDirWrapper(zis, entryName, System.currentTimeMillis(), bais);
+               }
                else if (JarUtils.isArchive(match) == false)
+               {
                   return new ZipEntryWrapper(zis, entryName, System.currentTimeMillis());
+               }
                else
+               {
                   return new ZipStreamWrapper(zis, entryName, System.currentTimeMillis());
+               }
             }
 
             if (longestNameMatch == null || longestNameMatch.length() < entryName.length())
@@ -404,10 +417,13 @@
             String parentPath = split[0];
             String name = split[1];
 
-            EntryInfo ei = entries.get(parentPath);
-            if(ei == null)
-               ei = makeDummyParent(parentPath);
-
+            EntryInfo ei = null;
+            if ("".equals(name) == false)
+            {
+               ei = entries.get(parentPath);
+               if(ei == null)
+                  ei = makeDummyParent(parentPath);
+            }
             AbstractVirtualFileHandler parent = ei != null ? ei.handler : null;
 
             if(ent.isDirectory() == false && JarUtils.isArchive(ent.getName()))
@@ -1104,6 +1120,9 @@
     */
    public static String [] splitParentChild(String pathName)
    {
+      if (pathName.startsWith("/"))
+         pathName = pathName.substring(1);
+      
       if(pathName.length() == 0)
          return new String [] {null, pathName};
 




More information about the jboss-cvs-commits mailing list