mirror of
https://github.com/openjdk/jdk7u.git
synced 2025-12-10 19:24:16 -06:00
8285726: [11u, 17u] Unify fix for JDK-8284548 with version from head
Reviewed-by: bae
This commit is contained in:
parent
ec0598f21c
commit
c83eb83fcc
@ -36,18 +36,26 @@ 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
|
||||
try {
|
||||
XPathFactory.newInstance().newXPath().compile(invalidXPath);
|
||||
} catch (XPathExpressionException e) {
|
||||
System.out.println("Caught expected exception: " + e.getClass().getName() +
|
||||
"(" + e.getMessage() + ").");
|
||||
} catch (Exception e) {
|
||||
System.out.println("Caught unexpected exception: " + e.getClass().getName() +
|
||||
"(" + e.getMessage() + ")!");
|
||||
throw e;
|
||||
for(String s: invalidXPath) {
|
||||
try {
|
||||
XPathFactory.newInstance().newXPath().compile(s);
|
||||
} catch (XPathExpressionException e) {
|
||||
System.out.println("Caught expected exception: " + e.getClass().getName() +
|
||||
"(" + e.getMessage() + ").");
|
||||
} catch (Exception e) {
|
||||
System.out.println("Caught unexpected exception: " + e.getClass().getName() +
|
||||
"(" + e.getMessage() + ")!");
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user