8285726: [11u, 17u] Unify fix for JDK-8284548 with version from head

Reviewed-by: bae
This commit is contained in:
Yuri Nesterenko 2022-05-16 12:20:06 +00:00
parent ec0598f21c
commit c83eb83fcc

View File

@ -36,11 +36,18 @@ public class InvalidXPath {
public static void main(String... args) {
// define an invalid XPath expression
final String invalidXPath = ">>";
final String[] invalidXPath = {
// @bug JDK-8284548: expressions ending with relational operators
// throw StringIndexOutOfBoundsException instead of XPathExpressionException
"/a/b/c[@d >",
"/a/b/c[@d <",
"/a/b/c[@d >=",
">>"
};
// expect XPathExpressionException when the invalid XPath expression is compiled
for(String s: invalidXPath) {
try {
XPathFactory.newInstance().newXPath().compile(invalidXPath);
XPathFactory.newInstance().newXPath().compile(s);
} catch (XPathExpressionException e) {
System.out.println("Caught expected exception: " + e.getClass().getName() +
"(" + e.getMessage() + ").");
@ -50,4 +57,5 @@ public class InvalidXPath {
throw e;
}
}
}
}