changeset 13201:3b551b5e8c84

8199547: Exception to Pattern Syntax Reviewed-by: rriggs
author igerasim
date Sat, 17 Mar 2018 14:14:23 -0700
parents 0e83ab36e12b
children 5802d4328c01
files src/share/classes/java/util/regex/PatternSyntaxException.java
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/util/regex/PatternSyntaxException.java	Tue Mar 06 18:29:10 2018 +0000
+++ b/src/share/classes/java/util/regex/PatternSyntaxException.java	Sat Mar 17 14:14:23 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, 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
@@ -113,7 +113,7 @@
         }
         sb.append(nl);
         sb.append(pattern);
-        if (index >= 0) {
+        if (index >= 0 && pattern != null && index < pattern.length()) {
             sb.append(nl);
             for (int i = 0; i < index; i++) sb.append(' ');
             sb.append('^');