[jboss-cvs] JBossAS SVN: r68897 - projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/classloader.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jan 11 11:41:17 EST 2008


Author: adrian at jboss.org
Date: 2008-01-11 11:41:17 -0500 (Fri, 11 Jan 2008)
New Revision: 68897

Modified:
   projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/classloader/PackageVisitor.java
Log:
[JBAS-5120] - Correctly handle the default package name when the virtual file is not itself the root of the VFS structure

Modified: projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/classloader/PackageVisitor.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/classloader/PackageVisitor.java	2008-01-11 16:34:33 UTC (rev 68896)
+++ projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/classloader/PackageVisitor.java	2008-01-11 16:41:17 UTC (rev 68897)
@@ -46,6 +46,9 @@
    /** The root */
    private String rootPath;
    
+   /** The root with slash*/
+   private String rootPathWithSlash;
+   
    /** The exportAll policy */
    private ExportAll exportAll;
 
@@ -72,7 +75,8 @@
    {
       if (root == null)
          throw new IllegalArgumentException("Null root");
-      rootPath = root.getPathName() + "/";
+      rootPath = root.getPathName();
+      rootPathWithSlash = rootPath + "/";
    }
    
    /**
@@ -125,8 +129,10 @@
             if (empty == false)
             {
                String path = file.getPathName();
-               if (path.startsWith(rootPath))
-                  path = path.substring(rootPath.length());
+               if (path.equals(rootPath))
+                  path = "";
+               else if (path.startsWith(rootPathWithSlash))
+                  path = path.substring(rootPathWithSlash.length());
                packages.add(path.replace('/', '.'));
             }
          }




More information about the jboss-cvs-commits mailing list