Three processing limits have been added to the XML libraries.
These are:
jdk.xml.xpathExprGrpLimit
Description: Limits the number of groups an XPath expression can
contain.
Type: integer
Value: A positive integer. A value less than or equal to 0
indicates no limit. If the value is not an integer, a
NumberFormatException
is thrown. Default 10.
Description: Limits the number of operators an XPath expression
can contain.
Type: integer
Value: A positive integer. A value less than or equal to 0
indicates no limit. If the value is not an integer, a
NumberFormatException
is thrown. Default 100.
jdk.xml.xpathTotalOpLimit
Description: Limits the total number of XPath operators in an
XSL Stylesheet.
Type: integer
Value: A positive integer. A value less than or equal to 0
indicates no limit. If the value is not an integer, a
NumberFormatException
is thrown. Default 10000.
Supported processors
Setting properties
For the XSLT processor, the properties can be changed through
the TransformerFactory
. For example,
TransformerFactory factory = TransformerFactory.newInstance();
factory.setAttribute("jdk.xml.xpathTotalOpLimit", "1000");
For the XPath processor, the properties can be changed through
the XPathFactory
. For example,
XPathFactory xf = XPathFactory.newInstance();
xf.setProperty("jdk.xml.xpathExprGrpLimit", "20");
For both the XPath and XSLT processors, the properties can be
set through the system property and jaxp.properties
configuration file located in the conf
directory of
the Java installation. For example,
System.setProperty("jdk.xml.xpathExprGrpLimit", "20");
or in the jaxp.properties
file,
jdk.xml.xpathExprGrpLimit=20
There are two known issues:
-
An XPath expression that contains a short form of the parent
axis ".." can return incorrect results. See JDK-8284920
for details.
-
An invalid XPath expression that ends with a relational operator
such as ‘<’ ‘>’ and ‘=’ will cause the processor to
erroneously throw StringIndexOutOfBoundsException instead of
XPathExpressionException. See JDK-8284548
for details.