You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by Wong Kok Wai <wo...@pacific.net.sg> on 2000/02/27 07:50:07 UTC

[Xerces-J] OT question on JAXP implementation

I like to ask a question on the implementation of
javax.xml.parsers.SAXParserFactory: Why is the advantage of using
Thread.currentThread().getContextClassLoader().loadClass() to load class
compare to Class.forName()?

(This implementation also mean Xerces cannot be compile with JDK 1.1.x).


Re: [Xerces-J] OT question on JAXP implementation

Posted by Pierpaolo Fumagalli <pi...@apache.org>.
Andy Clark wrote:
> 
> Pierpaolo Fumagalli wrote:
> > There's a HUGE document somewhere @ Sun explaining why and how
> > Class.forName() shouldn't be used in JDK 1.2 environments, and that's
> > the recomandation they give...
> >
> > I don't know, do I have to change it? Votes?
> 
> Regardless of this paper, if the code does not compile/run
> under a 1.1.x environment, then it should not be used. Are
> we voting on keeping the code or on changing it?

It's already changed... I've patched it yesterday, and uploaded on the
CVS repository...

	Pier

-- 
--------------------------------------------------------------------
-          P              I              E              R          -
stable structure erected over water to allow the docking of seacraft
<ma...@betaversion.org>    <http://www.betaversion.org/~pier/>
--------------------------------------------------------------------
- ApacheCON Y2K: Come to the official Apache developers conference -
-------------------- <http://www.apachecon.com> --------------------


Re: [Xerces-J] OT question on JAXP implementation

Posted by Andy Clark <an...@apache.org>.
Pierpaolo Fumagalli wrote:
> There's a HUGE document somewhere @ Sun explaining why and how
> Class.forName() shouldn't be used in JDK 1.2 environments, and that's
> the recomandation they give...
> 
> I don't know, do I have to change it? Votes?

Regardless of this paper, if the code does not compile/run
under a 1.1.x environment, then it should not be used. Are
we voting on keeping the code or on changing it?

-- 
Andy Clark * IBM, JTC - Silicon Valley * andyc@apache.org

Re: [Xerces-J] OT question on JAXP implementation

Posted by Pierpaolo Fumagalli <pi...@apache.org>.
Assaf Arkin wrote:
> 
> getContextClassLoader() is a way for someone up the heirarchy to let
> someone down the heirarchy know which class loader to use.
> 
> For example, if I have a Servlet container and my Serlvet is running in
> a special class loader X (for implementing reloading), and the Servlet
> calls some external library (in the App or Ext class loaders), and that
> external library has to load and initialize one of the classes in the
> Servlet JAR, the only way to make that magic work is using the context
> class loader.
> 
> I have no clue, though, why it would be needed in SAXParserFactory.
> Typically javax.xml.parsers would be running in the system class loaded,
> and the parser should be running either there or in the application
> class loader.
> 
> I don't know of any application where I would want to create a parser
> from my Serlvet where the parser code is coming from the Servlet class
> loader. Especially if it breaks 1.1 compatibility.

+1 ... removed...

	Pier

-- 
--------------------------------------------------------------------
-          P              I              E              R          -
stable structure erected over water to allow the docking of seacraft
<ma...@betaversion.org>    <http://www.betaversion.org/~pier/>
--------------------------------------------------------------------
- ApacheCON Y2K: Come to the official Apache developers conference -
-------------------- <http://www.apachecon.com> --------------------

Re: [Xerces-J] OT question on JAXP implementation

Posted by Assaf Arkin <ar...@exoffice.com>.
getContextClassLoader() is a way for someone up the heirarchy to let
someone down the heirarchy know which class loader to use.

For example, if I have a Servlet container and my Serlvet is running in
a special class loader X (for implementing reloading), and the Servlet
calls some external library (in the App or Ext class loaders), and that
external library has to load and initialize one of the classes in the
Servlet JAR, the only way to make that magic work is using the context
class loader.

I have no clue, though, why it would be needed in SAXParserFactory.
Typically javax.xml.parsers would be running in the system class loaded,
and the parser should be running either there or in the application
class loader.

I don't know of any application where I would want to create a parser
from my Serlvet where the parser code is coming from the Servlet class
loader. Especially if it breaks 1.1 compatibility.

arkin


Pierpaolo Fumagalli wrote:
> 
> Wong Kok Wai wrote:
> >
> > I like to ask a question on the implementation of
> > javax.xml.parsers.SAXParserFactory: Why is the advantage of using
> > Thread.currentThread().getContextClassLoader().loadClass() to load class
> > compare to Class.forName()?
> >
> > (This implementation also mean Xerces cannot be compile with JDK 1.1.x).
> 
> There's a HUGE document somewhere @ Sun explaining why and how
> Class.forName() shouldn't be used in JDK 1.2 environments, and that's
> the recomandation they give...
> 
> I don't know, do I have to change it? Votes?
> 
>         Pier
> --
> --------------------------------------------------------------------
> -          P              I              E              R          -
> stable structure erected over water to allow the docking of seacraft
> <ma...@betaversion.org>    <http://www.betaversion.org/~pier/>
> --------------------------------------------------------------------
> - ApacheCON Y2K: Come to the official Apache developers conference -
> -------------------- <http://www.apachecon.com> --------------------

Re: [Xerces-J] OT question on JAXP implementation

Posted by Pierpaolo Fumagalli <pi...@apache.org>.
Wong Kok Wai wrote:
> 
> I like to ask a question on the implementation of
> javax.xml.parsers.SAXParserFactory: Why is the advantage of using
> Thread.currentThread().getContextClassLoader().loadClass() to load class
> compare to Class.forName()?
> 
> (This implementation also mean Xerces cannot be compile with JDK 1.1.x).

There's a HUGE document somewhere @ Sun explaining why and how
Class.forName() shouldn't be used in JDK 1.2 environments, and that's
the recomandation they give...

I don't know, do I have to change it? Votes?

	Pier
-- 
--------------------------------------------------------------------
-          P              I              E              R          -
stable structure erected over water to allow the docking of seacraft
<ma...@betaversion.org>    <http://www.betaversion.org/~pier/>
--------------------------------------------------------------------
- ApacheCON Y2K: Come to the official Apache developers conference -
-------------------- <http://www.apachecon.com> --------------------