-
Bug
-
Resolution: Duplicate
-
P3
-
22
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
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
- duplicates
-
JDK-8322214 Return value of XMLInputFactory.getProperty() changed from boolean to String in JDK 22 early access builds
- Closed