cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rice Yeh (JIRA)" <j...@apache.org>
Subject [jira] Created: (COCOON-1921) A bug in org.apache.cocoon.classloader.DefaultClassLoader
Date Wed, 27 Sep 2006 09:47:50 GMT
A bug in org.apache.cocoon.classloader.DefaultClassLoader
---------------------------------------------------------

                 Key: COCOON-1921
                 URL: http://issues.apache.org/jira/browse/COCOON-1921
             Project: Cocoon
          Issue Type: Bug
          Components: * Cocoon Core
    Affects Versions: 2.2-dev (Current SVN)
            Reporter: Rice Yeh


On the implementation of loadClass(String name, boolean resolve) in DefaultClassLoader , when
there is no class found in child (that is, this classloader) classloader, the parent's loadClass()
method is called. However, on present implementation it is parent.loadClass(name) called,
which is the java.lang.ClassLoader's loadClass() called and it uses parent-first loading strategy.
In order to use child-first strategy (if the parent is also a DefaultClassLoader), the following
patch should be applied:

Index: C:/apache/cocoon.home/svn/trunk/core/cocoon-bootstrap/src/main/java/org/apache/cocoon/classloader/DefaultClassLoader.java
===================================================================
--- C:/apache/cocoon.home/svn/trunk/core/cocoon-bootstrap/src/main/java/org/apache/cocoon/classloader/DefaultClassLoader.java
(revision 449580)
+++ C:/apache/cocoon.home/svn/trunk/core/cocoon-bootstrap/src/main/java/org/apache/cocoon/classloader/DefaultClassLoader.java
(working copy)
@@ -130,7 +130,10 @@
                     throw new ClassNotFoundException(name);
                 } else {
                     // Will throw a CFNE if not found in parent
-                    clazz = parent.loadClass(name);
+                	if (parent instanceof DefaultClassLoader)
+                		clazz = ((DefaultClassLoader) parent).loadClass(name, resolve);
+                	else
+                		clazz = parent.loadClass(name);
                 }
             }
         }


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message