Summary
Add XPathFactoryImpl setProperty and getProperty methods.
Problem
In Java 18, refer to JDK-8276143, the setProperty and getProperty methods have been added to the XPathFactory. The implementation portion of the change needs to be backported since the functionality was a part of a larger JDK change for JDK 17 and earlier.
Solution
For JDK 17 and earlier, backport the implementation of the XPathFactory setProperty and getProperty methods, adding them to the JDK XPathFactory implementation class: XPathFactoryImpl. The public API change will not be backported.
Applications may call the new methods by checking whether the underlying implementation is the JDK default:
Option 1: create the XPathFactory by calling the newDefaultInstance methods for JDK 9 and later;
Option 2: check the underlying implementation, e.g. if (xpathFactory instanceof XPathFactoryImpl).
XPathFactory xf = XPathFactory.newInstance();
if (xf instanceof XPathFactoryImpl) {
XPathFactoryImpl xfJDK = (XPathFactoryImpl)xf;
xpJDK.setProperty(property, value);
} else {
return;
}
Specification
The impl changes only were backported to Update Releases. No spec changes
- csr of
-
JDK-8282610 XPathFactory set/getProperty method
-
- Resolved
-