Apache POI uses XMLInputFactory for handling XML and a unit-test verifies that setting properties has the expected effect.
When running tests with JDK 22, there is a failure because XMLInputFactory.getProperty() now returns the String "false", instead of Boolean.FALSE.
This looks like a change in behavior from JDK 21 to current JDK 22 early-access builds. Tested with JDK jdk-22-ea+18 and current jdk-22-ea+27.
The following simple unit-test works in JDK 8 - 21, but fails in early access builds of JDK 22 and JDK 23.
{noformat}
import static javax.xml.stream.XMLInputFactory.SUPPORT_DTD;
import static org.junit.jupiter.api.Assertions.assertFalse;
import javax.xml.stream.XMLInputFactory;
import org.junit.jupiter.api.Test;
public class TestXMLHelper {
@Test
public void testNewXMLInputFactory() {
XMLInputFactory factory = XMLInputFactory.newInstance();
factory.setProperty(SUPPORT_DTD, false);
assertFalse((boolean)factory.getProperty(XMLInputFactory.SUPPORT_DTD));
}
}
{noformat}
Since JDK 22 early access builds it fails with the following:
{noformat}
java.lang.ClassCastException: class java.lang.String cannot be cast to class java.lang.Boolean (java.lang.String and java.lang.Boolean are in module java.base of loader 'bootstrap')
at org.apache.poi.util.TestXMLHelper.testNewXMLInputFactory(TestXMLHelper.java:32)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
{noformat}