[jboss-cvs] JBossAS SVN: r95240 - in projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins: structure and 1 other directory.

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


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

Modified:
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/annotations/DeploymentUnitClassPath.java
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentContext.java
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSDeploymentResourceLoaderImpl.java
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSStructureBuilder.java
Log:
Fix file existence checks

Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/annotations/DeploymentUnitClassPath.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/annotations/DeploymentUnitClassPath.java	2009-10-21 03:09:20 UTC (rev 95239)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/annotations/DeploymentUnitClassPath.java	2009-10-21 03:20:22 UTC (rev 95240)
@@ -89,7 +89,7 @@
          for (VirtualFile cp : classPath)
          {
             file = cp.getChild(path);
-            if (file != null)
+            if (file.exists())
             {
                cache.put(className, file);
                return file;

Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentContext.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentContext.java	2009-10-21 03:09:20 UTC (rev 95239)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentContext.java	2009-10-21 03:20:22 UTC (rev 95240)
@@ -117,7 +117,7 @@
             throw new IllegalArgumentException("Null path in paths: " + paths);
 
          VirtualFile child = root.getChild(path);
-         if (child != null)
+         if (child.exists())
             locations.add(child);
          else
             log.debug("Meta data path does not exist: root=" + root.getPathName() + " path=" + path);
@@ -196,7 +196,7 @@
       for(VirtualFile location : getMetaDataLocations())
       {
          result = location.getChild(name);
-         if (result != null)
+         if (result.exists())
          {
             if (log.isTraceEnabled())
                log.trace("Found " + name + " in " + location.getName());

Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSDeploymentResourceLoaderImpl.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSDeploymentResourceLoaderImpl.java	2009-10-21 03:09:20 UTC (rev 95239)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSDeploymentResourceLoaderImpl.java	2009-10-21 03:20:22 UTC (rev 95240)
@@ -57,7 +57,8 @@
 
    public VirtualFile getFile(String path)
    {
-      return root.getChild(path);
+      final VirtualFile virtualFile = root.getChild(path);
+      return virtualFile.exists() ? virtualFile : null;
    }
 
    public URL getResource(String name)
@@ -65,7 +66,7 @@
       try
       {
          VirtualFile child = root.getChild(name);
-         return child != null ? child.toURL() : null;
+         return child.exists() ? child.toURL() : null;
       }
       catch (MalformedURLException e)
       {
@@ -82,7 +83,7 @@
       try
       {
          VirtualFile child = root.getChild(name);
-         if (child != null)
+         if (child.exists())
          {
             Vector<URL> vector = new Vector<URL>();
             vector.add(child.toURL());

Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSStructureBuilder.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSStructureBuilder.java	2009-10-21 03:09:20 UTC (rev 95239)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSStructureBuilder.java	2009-10-21 03:20:22 UTC (rev 95240)
@@ -87,9 +87,8 @@
          try
          {
             VirtualFile parentFile = vfsParent.getRoot();
-            @SuppressWarnings("deprecation")
             VirtualFile file = parentFile.getChild(path); // leaving the findChild usage
-            return new AbstractVFSDeploymentContext(applyModification(file, child), path);
+            return new AbstractVFSDeploymentContext(applyModification(file.exists() ? file : null, child), path);
          }
          catch (RuntimeException t)
          {




More information about the jboss-cvs-commits mailing list