[jboss-cvs] JBossAS SVN: r93196 - projects/ejb3/trunk/common/src/main/java/org/jboss/ejb3/common/classloader.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Sep 4 03:24:29 EDT 2009


Author: jaikiran
Date: 2009-09-04 03:24:29 -0400 (Fri, 04 Sep 2009)
New Revision: 93196

Modified:
   projects/ejb3/trunk/common/src/main/java/org/jboss/ejb3/common/classloader/PrimitiveAwareClassLoader.java
Log:
EJBTHREE-1910 Let the PrimitiveAwareClassLoader.loadClass internally start using PrimitiveClassLoadingUtil

Modified: projects/ejb3/trunk/common/src/main/java/org/jboss/ejb3/common/classloader/PrimitiveAwareClassLoader.java
===================================================================
--- projects/ejb3/trunk/common/src/main/java/org/jboss/ejb3/common/classloader/PrimitiveAwareClassLoader.java	2009-09-04 01:08:21 UTC (rev 93195)
+++ projects/ejb3/trunk/common/src/main/java/org/jboss/ejb3/common/classloader/PrimitiveAwareClassLoader.java	2009-09-04 07:24:29 UTC (rev 93196)
@@ -21,6 +21,7 @@
  */
 package org.jboss.ejb3.common.classloader;
 
+import org.jboss.ejb3.common.classloader.util.PrimitiveClassLoadingUtil;
 
 /**
  * PrimitiveAwareClassLoader
@@ -33,7 +34,8 @@
  * {@link Class} corresponding to the primitive. For all other requests, it redirects
  * the request to the parent classloader.
  *
- * @deprecated Do not use this "classloader" any more. Instead use the {@link PrimitiveClassLoadingUtil}
+ * @deprecated Since 1.0.1 version of jboss-ejb3-common : Do not use this "classloader" any more. 
+ * Instead use the {@link PrimitiveClassLoadingUtil}
  * utility to take care of centralized logic for primitive handling during classloading. See 
  * https://jira.jboss.org/jira/browse/EJBTHREE-1910 for more details.
  * 
@@ -57,62 +59,18 @@
    }
 
    /**
-    * As recommended in {@link ClassLoader#findClass(java.lang.String)}, the findClass method
-    * should be overriden by the custom classloaders. This method will first check whether 
-    * the requested <code>name</code> is a primitive. If yes, it returns the appropriate {@link Class}
-    * for the primitive. If not, then it lets the parent handle it.
+    * Since jboss-ejb3-common 1.0.1, this just delegates the call to 
+    * {@link PrimitiveClassLoadingUtil#loadClass(String, ClassLoader)} passing
+    * it the classloader returned by {@link #getParent()}.
     * 
+    * @see PrimitiveClassLoadingUtil
     */
    @Override
-   protected java.lang.Class<?> findClass(String name) throws ClassNotFoundException
+   public Class<?> loadClass(String name) throws ClassNotFoundException
    {
-
-      /*
-       * Handle Primitives
-       */
-      if (name.equals(void.class.getName()))
-      {
-         return void.class;
-      }
-      if (name.equals(byte.class.getName()))
-      {
-         return byte.class;
-      }
-      if (name.equals(short.class.getName()))
-      {
-         return short.class;
-      }
-      if (name.equals(int.class.getName()))
-      {
-         return int.class;
-      }
-      if (name.equals(long.class.getName()))
-      {
-         return long.class;
-      }
-      if (name.equals(char.class.getName()))
-      {
-         return char.class;
-      }
-      if (name.equals(boolean.class.getName()))
-      {
-         return boolean.class;
-      }
-      if (name.equals(float.class.getName()))
-      {
-         return float.class;
-      }
-      if (name.equals(double.class.getName()))
-      {
-         return double.class;
-      }
-
-      // Now that we know, its not a primitive, lets just allow
-      // the parent to handle the request.
-      // Note that we are intentionally using Class.forName(name,boolean,cl)
-      // to handle issues with loading array types in Java 6 http://bugs.sun.com/view_bug.do?bug_id=6434149
-      return Class.forName(name, false, this.getParent());
-
+      // EJBTHREE-1910 Let the new util handle this instead of we doing it ourselves
+      // See the javadocs of PrimitiveClassLoadingUtil for more details and reasoning
+      return PrimitiveClassLoadingUtil.loadClass(name, this.getParent());
    }
 
 }




More information about the jboss-cvs-commits mailing list