JDK-8322216 : Regression in feature support in SAXParser and SAXParserFactory
  • Type: Bug
  • Component: xml
  • Affected Version: 22
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2023-12-15
  • Updated: 2024-01-05
  • Resolved: 2024-01-05
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.
Other
tbdResolved
Related Reports
Duplicate :  
Description
There appears to be a regression in the feature support in SAXParser and SAXParserFactory in Java 22 early access builds.

Prior to recent early access builds, the following SaxParserTest class always printed "true" twice.

import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

import org.xml.sax.XMLReader;

public class SaxParserTest {

	public static void main(String[] args) throws Exception {
		SAXParserFactory parserFactory = SAXParserFactory.newInstance();
		parserFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
		System.out.println(parserFactory.getFeature("http://apache.org/xml/features/disallow-doctype-decl"));

		SAXParser saxParser = parserFactory.newSAXParser();
		XMLReader reader = saxParser.getXMLReader();
		System.out.println(reader.getFeature("http://apache.org/xml/features/disallow-doctype-decl"));
	}

}

Tested against Java 17, 21, and 22 EA.

Java 17:

$ java --show-version SaxParserTest.java
java 17.0.9 2023-10-17 LTS
Java(TM) SE Runtime Environment (build 17.0.9+11-LTS-201)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.9+11-LTS-201, mixed mode, sharing)
true
true

Java 21:

$ java --show-version SaxParserTest.java
java 21.0.1 2023-10-17 LTS
Java(TM) SE Runtime Environment (build 21.0.1+12-LTS-29)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.1+12-LTS-29, mixed mode, sharing)
true
true

Java 22 EA:

$ java --show-version SaxParserTest.java
openjdk 22-ea 2024-03-19
OpenJDK Runtime Environment (build 22-ea+27-2262)
OpenJDK 64-Bit Server VM (build 22-ea+27-2262, mixed mode, sharing)
false
false