[Jboss-cvs] JBossAS SVN: r55112 - projects/microcontainer/trunk/container/src/main/org/jboss/vfs/file

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Aug 3 09:59:09 EDT 2006


Author: scott.stark at jboss.org
Date: 2006-08-03 09:59:07 -0400 (Thu, 03 Aug 2006)
New Revision: 55112

Modified:
   projects/microcontainer/trunk/container/src/main/org/jboss/vfs/file/FileSystemVFS.java
Log:
Need to validate that a file that passes the JarImpl.isJar(String) test is actually a file and not a directory for an unpacked jar before using JarImpl.

Modified: projects/microcontainer/trunk/container/src/main/org/jboss/vfs/file/FileSystemVFS.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/vfs/file/FileSystemVFS.java	2006-08-03 13:58:02 UTC (rev 55111)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/vfs/file/FileSystemVFS.java	2006-08-03 13:59:07 UTC (rev 55112)
@@ -47,7 +47,7 @@
    /**
     * get VirtualFile from filesystem path
     *
-    * @param fp path, i.e. "/home/wburke/foo.jar"
+    * @param fileSystemPath path, i.e. "/home/wburke/foo.jar"
     * @return the VirtualFiel for fileSystemPath
     * @throws RuntimeException wrapper for any error  
     */
@@ -254,18 +254,25 @@
             {
                atomVF = childVF.findChild(atom);
             }
-            else if( JarImpl.isJar(atom) )
-            {
-               atomVF = new JarImpl(absPath, atomPath);
-               inJar = true;
-            }
             else
             {
-               URL atomParentURL = childVF == null ? parentURL : childVF.toURL();
-               String parentString = atomParentURL.toString();
-               if (!parentString.endsWith("/")) atomParentURL = new URL(parentString + "/");
-               URL filePath = new URL(atomParentURL, atom);
-               atomVF = new FileImpl(filePath, atomPath, this);
+               // Need to validate that the jar is not unpacked dir
+               StringBuilder tmp = new StringBuilder(atomPath);
+               File test = new File(tmp.toString());
+               if( test.isFile() && JarImpl.isJar(atom) )
+               {
+                  atomVF = new JarImpl(absPath, atomPath);
+                  inJar = true;
+               }
+               else
+               {
+                  URL atomParentURL = childVF == null ? parentURL : childVF.toURL();
+                  String parentString = atomParentURL.toString();
+                  if (!parentString.endsWith("/"))
+                     atomParentURL = new URL(parentString + "/");
+                  URL filePath = new URL(atomParentURL, atom);
+                  atomVF = new FileImpl(filePath, atomPath, this);
+               }
             }
             fileCache.put(atomPath, atomVF);
             childVF = atomVF;




More information about the jboss-cvs-commits mailing list