[jboss-cvs] JBossAS SVN: r59012 - trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Dec 13 07:42:30 EST 2006


Author: remy.maucherat at jboss.com
Date: 2006-12-13 07:42:28 -0500 (Wed, 13 Dec 2006)
New Revision: 59012

Modified:
   trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/VFSDirContext.java
Log:
Either I missed something, or isLeaf isn't behaving the same as it was before, as "my.jar".isLeaf() returns false.

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/VFSDirContext.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/VFSDirContext.java	2006-12-13 11:15:26 UTC (rev 59011)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/VFSDirContext.java	2006-12-13 12:42:28 UTC (rev 59012)
@@ -170,10 +170,11 @@
                 (sm.getString("resources.notFound", name));
         
         try {
-            if (!entry.isLeaf())
+            if (!isFile(entry)) {
                 return new VFSDirContext(entry);
-            else
+            } else {
                 return new VFSResource(entry);
+            }
         } catch (IOException e) {
             NamingException ex = new NamingException
                 (sm.getString("resources.notFound", name));
@@ -480,7 +481,7 @@
         try {
             attrs.setCreationDate(new Date(entry.getLastModified()));
             attrs.setName(entry.getName());
-            if (entry.isLeaf())
+            if (isFile(entry))
                 attrs.setResourceType("");
             attrs.setContentLength(entry.getSize());
             attrs.setLastModified(entry.getLastModified());
@@ -744,6 +745,15 @@
 
     // ------------------------------------------------------ Protected Methods
 
+    
+    /**
+     * Check if a VirtualFile is a regular file or a folder.
+     */
+    protected boolean isFile(VirtualFile file)
+       throws IOException {
+       return (file.isLeaf() || (file.getSize() > 0));
+    }
+    
 
     /**
      * Entry tree lookup.
@@ -773,14 +783,14 @@
         throws IOException {
         
         ArrayList<NamingEntry> entries = new ArrayList<NamingEntry>();
-        if (!entry.isLeaf()) {
+        if (!isFile(entry)) {
             Iterator<VirtualFile> children = entry.getChildren().iterator();
             NamingEntry namingEntry = null;
 
             while (children.hasNext()) {
                 VirtualFile current = children.next();
                 Object object = null;
-                if (!current.isLeaf()) {
+                if (!isFile(current)) {
                     object = new VFSDirContext(current);
                 } else {
                     object = new VFSResource(current);




More information about the jboss-cvs-commits mailing list