JDK-8032392 : Spec: javax.xml.stream.XMLEventFactory/XMLOutputFactory/XMLInputFactory.newFactory(String, ClassLoader) referring to ServiceLoader.load(Class, ClassLoader)
  • Type: Enhancement
  • Component: xml
  • Sub-Component: jaxp
  • Affected Version: 8
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2014-01-21
  • Updated: 2014-07-29
  • Resolved: 2014-01-28
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u20 b01Fixed 9Fixed
Description
Let's consider XMLEventFactory.newFactory(String factoryId, ClassLoader classLoader) spec excerpt:

   *   If {@code factoryId} is "javax.xml.stream.XMLEventFactory",
   *   use the service-provider loading facilities, defined by the
   *   {@link java.util.ServiceLoader} class, to attempt to locate and load an
   *   implementation of the service using the specified {@code ClassLoader}.
   *   If {@code classLoader} is null, the {@linkplain
   *   java.util.ServiceLoader#load(java.lang.Class) default loading mechanism} will apply:

Above excerpt refers to java.util.ServiceLoader#load(java.lang.Class) method for null classLoader case.

Similarly java.util.ServiceLoader#load(java.lang.Class, ClassLoader) should be referred for the case of non null classLoader; for instance like it's presented below:

   *   If {@code factoryId} is "javax.xml.stream.XMLEventFactory",
   *   use the service-provider loading facilities, defined by the
   *   {@link java.util.ServiceLoader} class, to attempt to {@linkplain java.util.ServiceLoader#load(java.lang.Class, java.lang.ClassLoader) locate and load} an
   *   implementation of the service using the specified {@code ClassLoader}.

The similar change should be applied:
to XMLInputFactory.newFactory(String factoryId, ClassLoader classLoader)
and to XMLOutputFactory.newFactory(String factoryId, ClassLoader classLoader).
Comments
Change in documentation.
28-07-2014

This is not a bug. The specification is clear in itself that the specified classLoader should be used when it is not null. Adding a hyperlink to the 2 args ServiceLoader.load(Class, ClassLoader) method makes it clear that with regards to the use of the service-provider loading facility, the 2 args method is used. This is indeed an enhancement since the suggested clarification would guarantee no potential changes/extensions in the service-provider loading facility could lead to ambiguous interpretation.
27-01-2014

Hi Joe, Since this is an enhancement you can work with the component team to defer this. When you do that please remove the defer label (8-defer-nmi) and set FixVersion to the new release.
22-01-2014

Release team: Please provide ILW/prio, justification for deferral + SQE OK.
21-01-2014