8199547: Exception to Pattern Syntax
authorsherman
Thu, 15 Mar 2018 16:04:30 -0700
changeset 51154 393f8a42190b
parent 51153 78f16a9f7563
child 51155 c2c9c209e22a
8199547: Exception to Pattern Syntax Reviewed-by: rriggs
src/java.base/share/classes/java/util/regex/PatternSyntaxException.java
--- a/src/java.base/share/classes/java/util/regex/PatternSyntaxException.java	Mon Feb 05 14:18:22 2018 -0800
+++ b/src/java.base/share/classes/java/util/regex/PatternSyntaxException.java	Thu Mar 15 16:04:30 2018 -0700
@@ -106,7 +106,7 @@
         }
         sb.append(System.lineSeparator());
         sb.append(pattern);
-        if (index >= 0) {
+        if (index >= 0 && pattern != null && index < pattern.length()) {
             sb.append(System.lineSeparator());
             for (int i = 0; i < index; i++) sb.append(' ');
             sb.append('^');