[jboss-cvs] JBossAS SVN: r100149 - projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jan 29 18:27:20 EST 2010


Author: thomas.diesler at jboss.com
Date: 2010-01-29 18:27:19 -0500 (Fri, 29 Jan 2010)
New Revision: 100149

Modified:
   projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading/AbstractClassLoaderDescribeDeployer.java
Log:
Prevent NPE on undeploy

Modified: projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading/AbstractClassLoaderDescribeDeployer.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading/AbstractClassLoaderDescribeDeployer.java	2010-01-29 23:23:29 UTC (rev 100148)
+++ projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading/AbstractClassLoaderDescribeDeployer.java	2010-01-29 23:27:19 UTC (rev 100149)
@@ -32,6 +32,8 @@
 
 /**
  * AbstractClassLoaderDescribeDeployer.
+ * 
+ * [TODO] Add meaningful javadoc. What is this suposed to do?
  *
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  * @version $Revision: 1.1 $
@@ -88,13 +90,13 @@
       ClassLoaderPolicyModule module = (ClassLoaderPolicyModule)unit.getAttachment(Module.class);
       if (module != null)
          return;
-      
+
       // We only look at non top level deployments that have classloading metadata
       if (unit.isTopLevel() == false)
       {
          if (deployment == null)
             return;
-         
+
          // For non top level classloaders, we need to control the domain
          // since the parent is the deployment classloader
          String unitName = unit.getName();
@@ -115,7 +117,7 @@
             log.debugf("Asked to create top level classloader for subdeployment: %1s", unitName);
          }
       }
-      
+
       // Create the module
       module = createModule(unit, deployment);
       if (module != null)
@@ -128,10 +130,9 @@
    public void undeploy(DeploymentUnit unit, ClassLoadingMetaData deployment)
    {
       Module module = unit.removeAttachment(Module.class);
-      if (module == null)
-         return;
-      classLoading.removeModule(module);
+      if (module != null && classLoading != null)
+         classLoading.removeModule(module);
    }
-   
+
    protected abstract ClassLoaderPolicyModule createModule(DeploymentUnit unit, ClassLoadingMetaData metaData) throws DeploymentException;
 }




More information about the jboss-cvs-commits mailing list