< prev index next >
test/java/util/regex/RegExTest.java
Print this page
rev 12216 : imported patch 8169056-StringIndexOutOfBoundsException-in-Pattern-compile-with-CANON_EQ-flag
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -30,11 +30,11 @@
* 4872664 4803179 4892980 4900747 4945394 4938995 4979006 4994840 4997476
* 5013885 5003322 4988891 5098443 5110268 6173522 4829857 5027748 6376940
* 6358731 6178785 6284152 6231989 6497148 6486934 6233084 6504326 6635133
* 6350801 6676425 6878475 6919132 6931676 6948903 6990617 7014645 7039066
* 7067045 7014640 7189363 8007395 8013252 8013254 8012646 8023647 6559590
- * 8027645 6854417
+ * 8027645 6854417 8169056
*/
import java.util.regex.*;
import java.util.Random;
import java.io.*;
@@ -2142,10 +2142,18 @@
int flags = Pattern.UNICODE_CASE | Pattern.CASE_INSENSITIVE;
pattern = Pattern.compile("[sik\u00c5]+", flags);
if (!pattern.matcher("\u017f\u0130\u0131\u212a\u212b").matches())
failCount++;
+ try {
+ Pattern.compile("[", Pattern.CANON_EQ);
+ failCount++;
+ } catch (PatternSyntaxException expected) {
+ } catch (Exception unexpected) {
+ failCount++;
+ }
+
report("CharClass");
}
private static void caretTest() throws Exception {
Pattern pattern = Pattern.compile("\\w*");
< prev index next >