Bug #6015
closedUsing the default JDK parser
100%
Description
We have a unit test that is doing
factory.setAttribute(FeatureKeys.SOURCE_PARSER_CLASS, "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl");
with the intent of ensuring that the default JDK XML parser is loaded, even if another SAX parser (such as Apache Xerces) is available on the classpath.
This fails (or gives warnings) on JDK 9+ because dynamic loading of internal classes ("com.sun.org...") is no longer allowed. The message is:
WARNING: An illegal reflective access operation has occurred
JDK 9 provides a way to get the default parser using SAXParserFactory.getDefaultInstance()
, but we don't provide a way to request that using Saxon configuration properties.
I propose that we recognize the setting
factory.setAttribute(FeatureKeys.SOURCE_PARSER_CLASS, "#DEFAULT");
as a way of requesting the default internal parser.
Note that internally, we have code in JavaPlatform.loadParserForXmlFragments()
that does what's needed, using either the JDK8 or JDK9 approach as appropriate.
Updated by Michael Kay about 1 year ago
- Description updated (diff)
- Category changed from Build and release to Configuration
- Status changed from New to Resolved
- Priority changed from Low to Normal
Updated by O'Neil Delpratt 11 months ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in Maintenance Release 12.3 added
Bug fix applied in the Saxon 12.3 maintenance release.
Updated by O'Neil Delpratt 11 months ago
- Status changed from Closed to Resolved
Leaving this bug issue as resolved until resolved against Saxon 11.
Updated by Debbie Lockett 9 months ago
- Status changed from Resolved to Closed
- Fixed in Maintenance Release 11.6 added
Bug fix applied in the Saxon 11.6 maintenance release.
Please register to edit this issue