changeset 51154:393f8a42190b

8199547: Exception to Pattern Syntax Reviewed-by: rriggs
author sherman
date Thu, 15 Mar 2018 16:04:30 -0700
parents 78f16a9f7563
children c2c9c209e22a
files src/java.base/share/classes/java/util/regex/PatternSyntaxException.java
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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('^');