Project

Profile

Help

Bug #6015

closed

Using the default JDK parser

Added by Michael Kay about 1 year ago. Updated 9 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Configuration
Sprint/Milestone:
-
Start date:
2023-05-05
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
11, 12, trunk
Fix Committed on Branch:
11, 12, trunk
Fixed in Maintenance Release:
Platforms:
Java

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.

Actions #1

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
Actions #3

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.

Actions #4

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.

Actions #5

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

Also available in: Atom PDF