[jboss-cvs] JBossAS SVN: r95298 - in projects/vfs/branches/Branch_2_2/src: main/java/org/jboss/virtual/plugins/context/vfs and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Oct 21 10:02:23 EDT 2009


Author: alesj
Date: 2009-10-21 10:02:22 -0400 (Wed, 21 Oct 2009)
New Revision: 95298

Modified:
   projects/vfs/branches/Branch_2_2/src/main/java/org/jboss/virtual/AssembledDirectory.java
   projects/vfs/branches/Branch_2_2/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledContextFactory.java
   projects/vfs/branches/Branch_2_2/src/test/java/org/jboss/test/virtual/test/AssembledContextTestCase.java
Log:
Fix dir removal - wrong name usage.

Modified: projects/vfs/branches/Branch_2_2/src/main/java/org/jboss/virtual/AssembledDirectory.java
===================================================================
--- projects/vfs/branches/Branch_2_2/src/main/java/org/jboss/virtual/AssembledDirectory.java	2009-10-21 14:01:13 UTC (rev 95297)
+++ projects/vfs/branches/Branch_2_2/src/main/java/org/jboss/virtual/AssembledDirectory.java	2009-10-21 14:02:22 UTC (rev 95298)
@@ -78,16 +78,37 @@
     */
    public static void removeAssembledDirectory(AssembledDirectory directory)
    {
-      AssembledContextFactory.getInstance().remove(directory);
+      try
+      {
+         if (directory.getParent() != null)
+            throw new RuntimeException("This is not the root of assembly");
+      }
+      catch (IOException e)
+      {
+         throw new RuntimeException(e);
+      }
+
+      removeDirectory(directory);
    }
 
+   /**
+    * Remove directory, w/o check.
+    *
+    * @param directory the directory to remove
+    */
+   protected static void removeDirectory(AssembledDirectory directory)
+   {
+      String name = directory.directory.getVFSContext().getName();
+      AssembledContextFactory.getInstance().remove(name);
+   }
+
    @Override
    public void cleanup()
    {
       try
       {
          if (getParent() == null)
-            removeAssembledDirectory(this);            
+            removeDirectory(this);            
       }
       catch (Exception ignored)
       {

Modified: projects/vfs/branches/Branch_2_2/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledContextFactory.java
===================================================================
--- projects/vfs/branches/Branch_2_2/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledContextFactory.java	2009-10-21 14:01:13 UTC (rev 95297)
+++ projects/vfs/branches/Branch_2_2/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledContextFactory.java	2009-10-21 14:02:22 UTC (rev 95298)
@@ -100,20 +100,11 @@
    /**
     * Remove an assembly
     *
-    * @param directory the directory
+    * @param name the name to remove
     */
-   public void remove(AssembledDirectory directory)
+   public void remove(String name)
    {
-      try
-      {
-         if (directory.getParent() != null)
-            throw new RuntimeException("This is not the root of assembly");
-      }
-      catch (IOException e)
-      {
-         throw new RuntimeException(e);
-      }
-      registry.remove(directory.getName());
+      registry.remove(name);
    }
 
    /**

Modified: projects/vfs/branches/Branch_2_2/src/test/java/org/jboss/test/virtual/test/AssembledContextTestCase.java
===================================================================
--- projects/vfs/branches/Branch_2_2/src/test/java/org/jboss/test/virtual/test/AssembledContextTestCase.java	2009-10-21 14:01:13 UTC (rev 95297)
+++ projects/vfs/branches/Branch_2_2/src/test/java/org/jboss/test/virtual/test/AssembledContextTestCase.java	2009-10-21 14:02:22 UTC (rev 95298)
@@ -268,7 +268,7 @@
       {
          if (child.getName().startsWith("Nested")) throw new RuntimeException("did not exclude propertly");
       }
-      AssembledContextFactory.getInstance().remove(directory);
+      AssembledDirectory.removeAssembledDirectory(directory);
    }
 
    public void testMkDir() throws Exception




More information about the jboss-cvs-commits mailing list