[jboss-cvs] JBossAS SVN: r57655 - projects/microcontainer/trunk/container/src/main/org/jboss/virtual

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Oct 13 02:35:09 EDT 2006


Author: scott.stark at jboss.org
Date: 2006-10-13 02:35:07 -0400 (Fri, 13 Oct 2006)
New Revision: 57655

Modified:
   projects/microcontainer/trunk/container/src/main/org/jboss/virtual/VFSUtils.java
Log:
Update the manifest parsing to resolve the paths against the vfs root url to deal with . and .. relative paths.

Modified: projects/microcontainer/trunk/container/src/main/org/jboss/virtual/VFSUtils.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/virtual/VFSUtils.java	2006-10-13 05:46:20 UTC (rev 57654)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/virtual/VFSUtils.java	2006-10-13 06:35:07 UTC (rev 57655)
@@ -26,6 +26,7 @@
 import java.io.UnsupportedEncodingException;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -120,6 +121,21 @@
       if (parent == null)
          throw new IllegalStateException(file + " has no parent.");
 
+      URL parentURL = null;
+      URL vfsRootURL = null;
+      int rootPathLength = 0;
+      try
+      {
+         parentURL = parent.toURL();
+         vfsRootURL = file.getVFS().getRoot().toURL();
+         rootPathLength = vfsRootURL.getPath().length();
+      }
+      catch(URISyntaxException e)
+      {
+         IOException ioe = new IOException("Failed to get parent URL");
+         ioe.initCause(e);
+      }
+
       StringTokenizer tokenizer = new StringTokenizer(classPath);
       while (tokenizer.hasMoreTokens())
       {
@@ -127,7 +143,10 @@
 
          try
          {
-            VirtualFile vf = parent.findChild(path);
+            URL libURL = new URL(parentURL, path);
+            String libPath = libURL.getPath();
+            String vfsLibPath = libPath.substring(rootPathLength);
+            VirtualFile vf = file.getVFS().findChild(vfsLibPath);
             paths.add(vf);
          }
          catch (IOException e)




More information about the jboss-cvs-commits mailing list