FULL PRODUCT VERSION :
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
The documentation for SchemaFactory.newInstance includes:
"The (context) class loader is asked for service provider provider-configuration files matching javax.xml.validation.SchemaFactory in the resource directory META-INF/services"
This does not work as expected. The context class loader is not consulted. In javax.xml.validation.SecuritySupport.getResources there is the code fragment:
if (cl == null) {
enumeration = ClassLoader.getSystemResources(name);
} else {
enumeration = cl.getSystemResources(name);
}
getSystemResouces is a static method, so both parts of the if are doing the same thing.
I believe the code should read:
if (cl == null) {
enumeration = ClassLoader.getSystemResources(name);
} else {
enumeration = cl.getResources(name);
}
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a jar file containing a META-INF/services definition for schema factory and set the context class loader to a url class loader pointing at the jar. When SchemaFactory.newInstance is called, the context class loader is not consulted.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Service definition in context class loader should be checked.
ACTUAL -
It is not.
REPRODUCIBILITY :
This bug can be reproduced always.