Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8152063

Add module-friendly ability to specify default JAXP providers

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P3 P3
    • tbd
    • 9
    • xml
    • None
    • Cause Known

      In Java 8 and earlier, the default JAXP provider can be specified by way
      of a system property, or by making an appropriate factory implementation
      available from the context class loader. While this still functions in
      Java 9, with the increased isolation of modules it is very difficult to
      change the default JAXP provider classes to classes from modules. Prior
      to Java 9 it was possible to install JAXP implementation classes which
      acted as a proxy to non-classpath classes; however the introduction of
      modules prevents this trick from working because the system default
      classes are not generally accessible.

      A better solution is to add a setter method which allows a Class<?
      extends JAXPType> or Supplier<JAXPType> to be installed by sufficiently
      privileged callers, which would take the place of the global default and
      would be returned before falling back to the old system property based
      mechanism.

      The affected types include:

      javax.xml.datatype.DatatypeFactory
      javax.xml.parsers.DocumentBuilderFactory
      javax.xml.parsers.SAXParserFactory
      javax.xml.validation.SchemaFactory
      javax.xml.transform.sax.SAXTransformerFactory
      javax.xml.stream.XMLEventFactory
      javax.xml.stream.XMLInputFactory
      javax.xml.stream.XMLOutputFactory
      javax.xml.xpath.XPathFactory

      Also org.xml.sax.XMLReader implementations are located in a similar
      manner. Other "FactoryFinder"-style APIs might also benefit in a
      similar manner, however if they reside in upgradeable modules it is
      likely less urgent.

            dfuchs Daniel Fuchs
            andrew Andrew Hughes
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: