> -----Original Message-----
> From: Scott Sanders [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 19, 2001 5:00 PM
>
> Committed, thank you very much. The only thing is that I
> updated to include
> the other rules that looked for the context class loader,
> that you did not
> include in your patch. Good patch otherwise!
Sorry, I did not look to hard to see where else the
classloader was used.
> Gidado, could you test the patch to see if it is what you are
> expecting?
> Thanks a lot.
I've updated my sandbox, and the changes work fine for me.
My test was to run it againt my own code, otherwise there
was no extensive testing.
> About the default being false (do not use context class loader), I was
> wondering if that should be true or not? All of my use of
> Digester is in a
> web application context, so I would prefer it to be true.
> What are other
> people's thoughts on the matter.
Yes, I use it in webapp context also. Let's explore 2 scenarios
starting with the following:
. my code (in webapp context) creates a Digester
. add rule-A to digester
. call digester.parse()
Senario 1: digester.setUseContextClassLoader(false)
. digester fires rule-A which needs class 'my.code.Run'
. uses Class.forName() which uses ClassLoader of Digester
Digester is defined in webapp-ClassLoader, so that's
the one that's used
. webapp-ClassLoader delegates to bootClassLoader, which
fails to find it
. the webapp-Classloader looks for and finds the class
Senario 2: digester.setUseContextClassLoader(true)
. digester fires rule-A which needs class 'a.b.stuff'
. uses the Context ClassLoader. This classloader is rooted
in the servlet-container and is quite likely the
bootClassLoader.
. bootClassLoader cannot find the class, and the
ClassNotFoundException is thrown.
Scenario 1 is the behavior I want, so I set it as the default.
In fact, do we ever really need to check the Context ClassLoader
at all?
- Gidado