[jboss-cvs] JBossAS SVN: r95246 - in projects/jboss-deployers/branches/vfs3: deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/support and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Oct 20 23:37:39 EDT 2009


Author: david.lloyd at jboss.com
Date: 2009-10-20 23:37:38 -0400 (Tue, 20 Oct 2009)
New Revision: 95246

Modified:
   projects/jboss-deployers/branches/vfs3/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AddVisitor.java
   projects/jboss-deployers/branches/vfs3/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MetaDataStructureModificationChecker.java
   projects/jboss-deployers/branches/vfs3/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/UpdateDeleteVisitor.java
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/war/support/MockWarStructureDeployer.java
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/support/WebBeanDiscoveryDeployer.java
Log:
Fix file existence checks yet even still more

Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/war/support/MockWarStructureDeployer.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/war/support/MockWarStructureDeployer.java	2009-10-21 03:33:37 UTC (rev 95245)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/war/support/MockWarStructureDeployer.java	2009-10-21 03:37:38 UTC (rev 95246)
@@ -32,7 +32,7 @@
 import org.jboss.vfs.VirtualFile;
 import org.jboss.vfs.VirtualFileFilter;
 import org.jboss.vfs.VisitorAttributes;
-import org.jboss.vfs.plugins.vfs.helpers.SuffixMatchFilter;
+import org.jboss.vfs.util.SuffixMatchFilter;
 
 /**
  * MockWarStructure.
@@ -116,24 +116,16 @@
             // We require either a WEB-INF or the name ends in .war
             if (file.getName().endsWith(".war") == false)
             {
-               try
+               VirtualFile child = file.getChild("WEB-INF");
+               if (child.exists())
                {
-                  VirtualFile child = file.getChild("WEB-INF");
-                  if (child != null)
-                  {
-                     if (trace)
-                        log.trace("... ok - directory has a WEB-INF subdirectory");
-                  }
-                  else
-                  {
-                     if (trace)
-                        log.trace("... no - doesn't look like a war and no WEB-INF subdirectory.");
-                     return false;
-                  }
+                  if (trace)
+                     log.trace("... ok - directory has a WEB-INF subdirectory");
                }
-               catch (IOException e)
+               else
                {
-                  log.warn("Exception while checking if file is a war: " + e);
+                  if (trace)
+                     log.trace("... no - doesn't look like a war and no WEB-INF subdirectory.");
                   return false;
                }
             }
@@ -147,26 +139,17 @@
 
             // Check for WEB-INF/classes
             VirtualFile classes = null;
-            try
-            {
-               // The classpath contains WEB-INF/classes
-               classes = file.getChild("WEB-INF/classes");
-
-               // Check for a META-INF for metadata
-               if (classes != null)
-                  metaDataLocations.add("WEB-INF/classes/META-INF");
-            }
-            catch(IOException e)
-            {
-               log.warn("Exception while looking for classes, " + file.getPathName() + ", " + e);
-            }
-
+            // The classpath contains WEB-INF/classes
+            classes = file.getChild("WEB-INF/classes");
+            // Check for a META-INF for metadata
+            if (classes.exists())
+               metaDataLocations.add("WEB-INF/classes/META-INF");
             // Check for jars in WEB-INF/lib
             List<VirtualFile> archives = null;
             try
             {
                VirtualFile webinfLib = file.getChild("WEB-INF/lib");
-               if (webinfLib != null)
+               if (webinfLib.exists())
                {
                   archives = webinfLib.getChildren(webInfLibFilter);
                   // Add the jars' META-INF for metadata

Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/support/WebBeanDiscoveryDeployer.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/support/WebBeanDiscoveryDeployer.java	2009-10-21 03:33:37 UTC (rev 95245)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/support/WebBeanDiscoveryDeployer.java	2009-10-21 03:37:38 UTC (rev 95246)
@@ -72,7 +72,7 @@
          for (VirtualFile cp : classpaths)
          {
             VirtualFile wbXml = cp.getChild("META-INF/web-beans.xml");
-            if (wbXml != null)
+            if (wbXml.exists())
             {
                // add url
                wbdi.addWebBeansXmlURL(wbXml.toURL());

Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AddVisitor.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AddVisitor.java	2009-10-21 03:33:37 UTC (rev 95245)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AddVisitor.java	2009-10-21 03:37:38 UTC (rev 95246)
@@ -57,7 +57,7 @@
       String originalPathName = file.getPathName();
       String pathName = originalPathName.substring(initialPathLenght);
       VirtualFile child = tempRoot.getChild(pathName);
-      if (child == null)
+      if (! child.exists())
       {
          // original was added
          long timestamp = getSynchAdapter().add(file, tempRoot, pathName);

Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MetaDataStructureModificationChecker.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MetaDataStructureModificationChecker.java	2009-10-21 03:33:37 UTC (rev 95245)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MetaDataStructureModificationChecker.java	2009-10-21 03:37:38 UTC (rev 95246)
@@ -130,7 +130,7 @@
    {
       String path = contextInfo.getPath();
       VirtualFile contextRoot = root.getChild(path);
-      if (contextRoot != null)
+      if (contextRoot.exists())
       {
          List<String> metadataPaths = contextInfo.getMetaDataPath();
          if (metadataPaths != null && metadataPaths.isEmpty() == false)
@@ -138,7 +138,7 @@
             for (String metaDataPath : metadataPaths)
             {
                VirtualFile mdpVF = contextRoot.getChild(metaDataPath);
-               if (mdpVF != null)
+               if (mdpVF.exists())
                {
                   List<VirtualFile> children = mdpVF.getChildren(filter);
                   List<VirtualFile> leaves = getCache().getLeaves(mdpVF, filter);

Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/UpdateDeleteVisitor.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/UpdateDeleteVisitor.java	2009-10-21 03:33:37 UTC (rev 95245)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/UpdateDeleteVisitor.java	2009-10-21 03:37:38 UTC (rev 95246)
@@ -57,7 +57,7 @@
       String pathName = file.getPathName();
       String originalPathName = initialPath + pathName;
       VirtualFile child = originalRoot.getChild(pathName);
-      if (child == null)
+      if (! child.exists())
       {
          // original was deleted, try deleting the temp
          if (getSynchAdapter().delete(file))




More information about the jboss-cvs-commits mailing list