[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SAX-core proposal #1: class loading
- From: David Brownell <david-b@pacbell.net>
- To: sax-devel@lists.sourceforge.net, xml-dev@lists.xml.org
- Date: Tue, 07 Aug 2001 10:04:57 -0700
This seems to me most like a bugfix, but I'm sending it for
possible discussion in case anyone has issues.
Class Loading
- JDK 1.2 added a notion of chained class loaders, where loaders
can try to load from a "parent" that may not be shared with
every other class in the sytem.
- Implementations of factory helper classes (XMLReaderFactory,
ParserFactory) don't pass a class loader to Class.forName(),
so they always use the system class loader. They could use
a more intelligent default, at least on JDK 1.2 systems:
Thread.currentThread ().getContextClassLoader ()
That way, for example, application code wouldn't need to
have the parser always live in the system class path.
Interfaces to those helper classes don't pass the loader (and
normally shouldn't), so applications using the factory classes
can't work around that issue themselves.
PROPOSAL:
- Clarify the javadoc to say that while the system class
loader is consulted, other appropriate ones may also
be used. That will allow JDK 1.2 (and later) based
factories to use the context's class loader.
- Use the (package private) NewInstance.java loader support
from the Crimson tree, portably fixing this implementation
issue for everyone. (Except for needing a JDK 1.2 compatible
build environment ...) This is seemingly public domain since
there's no copyright...
[ Mentioned by Miles Sabin; happened across the fix in Crimson ]