[jboss-cvs] JBossAS SVN: r83797 - in projects/vfs/trunk/src/main/java/org/jboss/virtual: plugins/registry and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Feb 3 01:46:13 EST 2009


Author: alesj
Date: 2009-02-03 01:46:13 -0500 (Tue, 03 Feb 2009)
New Revision: 83797

Modified:
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/temp/BasicTempInfo.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/registry/DefaultVFSRegistry.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/TempInfo.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/registry/VFSRegistry.java
Log:
javadocs
Some null checks.

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/temp/BasicTempInfo.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/temp/BasicTempInfo.java	2009-02-03 06:27:58 UTC (rev 83796)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/temp/BasicTempInfo.java	2009-02-03 06:46:13 UTC (rev 83797)
@@ -28,7 +28,7 @@
 import org.jboss.virtual.spi.VirtualFileHandler;
 
 /**
- * AbstractTempInfo
+ * BasicTempInfo
  *
  * @author <a href="ales.justin at jboss.com">Ales Justin</a>
  */
@@ -40,7 +40,13 @@
 
    public BasicTempInfo(String path, File file, VirtualFileHandler handler)
    {
+      if (path == null)
+         throw new IllegalArgumentException("Null path");
+      if (file == null && handler == null)
+         throw new IllegalArgumentException("Both, file and handler, are null");
+
       this.path = path;
+      // file and handler can even be null
       this.file = file;
       this.handler = handler;
    }
@@ -68,11 +74,6 @@
       return handler;
    }
 
-   public void setHandler(VirtualFileHandler handler)
-   {
-      this.handler = handler;
-   }
-
    @Override
    public String toString()
    {

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/registry/DefaultVFSRegistry.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/registry/DefaultVFSRegistry.java	2009-02-03 06:27:58 UTC (rev 83796)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/registry/DefaultVFSRegistry.java	2009-02-03 06:46:13 UTC (rev 83797)
@@ -74,10 +74,14 @@
          for (TempInfo ti : context.getTempInfos())
          {
             String path = ti.getPath();
-            if (relativePath.startsWith(path))
+            if (relativePath.startsWith(path) && ti.getHandler() != null)
             {
                VirtualFileHandler handler = ti.getHandler();
-               VirtualFileHandler child = handler.getChild(relativePath.substring(path.length()));
+               String subpath = relativePath.substring(path.length());
+               VirtualFileHandler child = handler.getChild(subpath);
+               if (child == null)
+                  throw new IOException("Cannot find child, root=" + handler + ", relativePath=" + subpath);
+
                return child.getVirtualFile();
             }
          }

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/TempInfo.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/TempInfo.java	2009-02-03 06:27:58 UTC (rev 83796)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/TempInfo.java	2009-02-03 06:46:13 UTC (rev 83797)
@@ -30,11 +30,29 @@
  */
 public interface TempInfo
 {
+   /**
+    * Get relative path to vfs context.
+    *
+    * @return the relative path
+    */
    String getPath();
 
+   /**
+    * Get temp file.
+    *
+    * @return the temp file
+    */
    File getTempFile();
 
+   /**
+    * Do temp info cleanup.
+    */
    void cleanup();
 
+   /**
+    * Get the new temp handler.
+    *
+    * @return the temp handler
+    */
    VirtualFileHandler getHandler();
 }
\ No newline at end of file

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/registry/VFSRegistry.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/registry/VFSRegistry.java	2009-02-03 06:27:58 UTC (rev 83796)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/registry/VFSRegistry.java	2009-02-03 06:46:13 UTC (rev 83797)
@@ -35,6 +35,11 @@
  */
 public abstract class VFSRegistry
 {
+   /**
+    * Get an instance of vfs registry.
+    *
+    * @return the vfs registry instance
+    */
    public static VFSRegistry getInstance()
    {
       return VFSRegistryBuilder.getInstance();




More information about the jboss-cvs-commits mailing list