[jboss-cvs] JBossAS SVN: r70946 - projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Mar 18 08:13:54 EDT 2008


Author: alesj
Date: 2008-03-18 08:13:54 -0400 (Tue, 18 Mar 2008)
New Revision: 70946

Modified:
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryContents.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryHandler.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/SynthenticDirEntryHandler.java
Log:
Removing unused FNFE.

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryContents.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryContents.java	2008-03-18 11:31:15 UTC (rev 70945)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryContents.java	2008-03-18 12:13:54 UTC (rev 70946)
@@ -22,7 +22,6 @@
 package org.jboss.virtual.plugins.context.jar;
 
 import java.io.ByteArrayInputStream;
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URI;
@@ -146,7 +145,7 @@
          return njar.createChildHandler(name);
       }
       else
-         return findChildHandler(name, true);
+         return findChildHandler(name);
    }
 
    public VirtualFileHandler getChild(String path) throws IOException
@@ -174,18 +173,13 @@
     * TODO: synchronization on lazy entryMap creation
     *
     * @param name the path name
-    * @param allowNull do we allow nulls
     * @return handler or <code>null</code> is it doesn't exist
     * @throws IOException for any error
     */
-   protected synchronized VirtualFileHandler findChildHandler(String name, boolean allowNull) throws IOException
+   protected synchronized VirtualFileHandler findChildHandler(String name) throws IOException
    {
       if (entryChildren == null)
-      {
-         if (allowNull)
-            return null;
-         throw new FileNotFoundException(this + " has no children");
-      }
+         return null;
 
       if (entryMap == null)
       {
@@ -193,10 +187,7 @@
          for (VirtualFileHandler child : entryChildren)
             entryMap.put(child.getName(), child);
       }
-      VirtualFileHandler child = entryMap.get(name);
-      if (child == null && allowNull == false)
-         throw new FileNotFoundException(this + " has no child: " + name);
-      return child;
+      return entryMap.get(name);
    }
 
    // Convience attribute accessors

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryHandler.java	2008-03-18 11:31:15 UTC (rev 70945)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryHandler.java	2008-03-18 12:13:54 UTC (rev 70946)
@@ -21,7 +21,6 @@
 */
 package org.jboss.virtual.plugins.context.jar;
 
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URISyntaxException;
@@ -34,8 +33,8 @@
 import java.util.jar.JarFile;
 import java.util.zip.ZipEntry;
 
-import org.jboss.virtual.plugins.context.StructuredVirtualFileHandler;
 import org.jboss.virtual.plugins.context.HierarchyVirtualFileHandler;
+import org.jboss.virtual.plugins.context.StructuredVirtualFileHandler;
 import org.jboss.virtual.spi.VFSContext;
 import org.jboss.virtual.spi.VirtualFileHandler;
 
@@ -145,33 +144,11 @@
       return getJar().getInputStream(getEntry());
    }
 
-   public VirtualFileHandler createChildHandler(String name) throws IOException
+   // TODO: synchronization on lazy entryMap creation
+   public synchronized VirtualFileHandler createChildHandler(String name) throws IOException
    {
-      return findChildHandler(name, true);
-   }
-
-   public VirtualFileHandler getChild(String path) throws IOException
-   {
-      return structuredFindChild(path);
-   }
-
-   /**
-    * Find the handler.
-    * TODO: synchronization on lazy entryMap creation
-    *
-    * @param name the path name
-    * @param allowNull do we allow nulls
-    * @return handler or <code>null</code> is it doesn't exist
-    * @throws IOException for any error
-    */
-   protected synchronized VirtualFileHandler findChildHandler(String name, boolean allowNull) throws IOException
-   {
       if (entryChildren == null)
-      {
-         if (allowNull)
-            return null;
-         throw new FileNotFoundException(this + " has no children");
-      }
+         return null;
 
       if (entryMap == null)
       {
@@ -179,9 +156,11 @@
          for (VirtualFileHandler child : entryChildren)
             entryMap.put(child.getName(), child);
       }
-      VirtualFileHandler child = entryMap.get(name);
-      if (child == null && allowNull == false)
-         throw new FileNotFoundException(this + " has no child: " + name);
-      return child;
+      return entryMap.get(name);
    }
+
+   public VirtualFileHandler getChild(String path) throws IOException
+   {
+      return structuredFindChild(path);
+   }
 }

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/SynthenticDirEntryHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/SynthenticDirEntryHandler.java	2008-03-18 11:31:15 UTC (rev 70945)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/SynthenticDirEntryHandler.java	2008-03-18 12:13:54 UTC (rev 70946)
@@ -21,7 +21,6 @@
 */
 package org.jboss.virtual.plugins.context.jar;
 
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URISyntaxException;
@@ -33,8 +32,8 @@
 import java.util.Map;
 
 import org.jboss.virtual.plugins.context.AbstractURLHandler;
-import org.jboss.virtual.plugins.context.StructuredVirtualFileHandler;
 import org.jboss.virtual.plugins.context.HierarchyVirtualFileHandler;
+import org.jboss.virtual.plugins.context.StructuredVirtualFileHandler;
 import org.jboss.virtual.spi.VFSContext;
 import org.jboss.virtual.spi.VirtualFileHandler;
 
@@ -162,33 +161,11 @@
     * @throws IOException - thrown if there are no children or the
     *                     name does not match a child
     */
+   // TODO: synchronization on lazy entryMap creation
    public synchronized VirtualFileHandler createChildHandler(String name) throws IOException
    {
-      return findChildHandler(name, true);
-   }
-
-   public VirtualFileHandler getChild(String path) throws IOException
-   {
-      return structuredFindChild(path);
-   }
-
-   /**
-    * Find the handler.
-    * TODO: synchronization on lazy entryMap creation
-    *
-    * @param name the path name
-    * @param allowNull do we allow nulls
-    * @return handler or <code>null</code> is it doesn't exist
-    * @throws IOException for any error
-    */
-   protected synchronized VirtualFileHandler findChildHandler(String name, boolean allowNull) throws IOException
-   {
       if (entryChildren == null)
-      {
-         if (allowNull)
-            return null;
-         throw new FileNotFoundException(this + " has no children");
-      }
+         return null;
 
       if (entryMap == null)
       {
@@ -196,9 +173,11 @@
          for (VirtualFileHandler child : entryChildren)
             entryMap.put(child.getName(), child);
       }
-      VirtualFileHandler child = entryMap.get(name);
-      if (child == null && allowNull == false)
-         throw new FileNotFoundException(this + " has no child: " + name);
-      return child;
+      return entryMap.get(name);
    }
+
+   public VirtualFileHandler getChild(String path) throws IOException
+   {
+      return structuredFindChild(path);
+   }
 }




More information about the jboss-cvs-commits mailing list