JAXP default implementation and JDK-8152063
daniel.fuchs at oracle.com
Thu Mar 24 14:40:26 UTC 2016
On 24/03/16 15:29, David M. Lloyd wrote:
> Daniel, I have hacked together a way to use the system class loader
> (which should be "good enough", I hope), but there is one further
> problem: org.xml.sax.helpers.XMLReaderFactory does not have a factory
> method which accepts a class loader like the others do. Any thoughts on
> this one? It looks like it might be pretty easy to add this method...
> but then, it's also pretty easy to just add setters to set the default
> Class :)
The XMLReaderFactory is a kind of strange beast because it doesn't
use the ServiceLoader either: the specification doesn't adhere to
the ServiceLoader convention - so the class still forage for itself
inside the META-INF/services resource directory.
It may be something we will need to fix - but I'll defer to
Joe Wang in that matter.
As a general rule my personal taste would be to avoid global setters,
as these usually come with a whole lot of issues (security,
race conditions (if two pieces of code try to set different defaults),
So if we can find a suitable solution that can leverage the
ServiceLoader mechanism that would have my preference by far :-)
More information about the core-libs-dev