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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Sep 4 05:56:39 EDT 2009


Author: jaikiran
Date: 2009-09-04 05:56:38 -0400 (Fri, 04 Sep 2009)
New Revision: 93200

Modified:
   projects/ejb3/trunk/common/src/main/java/org/jboss/ejb3/common/classloader/util/PrimitiveClassLoadingUtil.java
Log:
EJBTHREE-1910 Change the implementation of loadClass to allow handling of arrays in JDK-1.6

Modified: projects/ejb3/trunk/common/src/main/java/org/jboss/ejb3/common/classloader/util/PrimitiveClassLoadingUtil.java
===================================================================
--- projects/ejb3/trunk/common/src/main/java/org/jboss/ejb3/common/classloader/util/PrimitiveClassLoadingUtil.java	2009-09-04 09:40:06 UTC (rev 93199)
+++ projects/ejb3/trunk/common/src/main/java/org/jboss/ejb3/common/classloader/util/PrimitiveClassLoadingUtil.java	2009-09-04 09:56:38 UTC (rev 93200)
@@ -38,9 +38,12 @@
    /**
     * First checks if <code>name</code> is a primitive type. If yes, then returns
     * the corresponding {@link Class} for that primitive. If it's not a primitive
-    * then the {@link ClassLoader#loadClass(String)} method is invoked, passing
-    * it the <code>name</code>
+    * then the {@link Class#forName(String, boolean, ClassLoader)} method is invoked, passing
+    * it the <code>name</code>, false and the <code>cl</code> classloader
     * 
+    * Note that we intentionally use 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
+    * 
     * @param name The class that has to be loaded
     * @param cl The {@link ClassLoader} to use, if <code>name</code> is *not* a primitive
     * @return Returns the {@link Class} corresponding to <code>name</code>
@@ -89,7 +92,11 @@
       {
          return double.class;
       }
-      // It's not a primitive so let the classloader handle it
-      return cl.loadClass(name);
+      // Now that we know its not a primitive, lets just allow
+      // the passed classloader 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, cl);
+
    }
 }




More information about the jboss-cvs-commits mailing list