From e15632d9572c29c182637ba500fb79ed93cde2fe Mon Sep 17 00:00:00 2001 From: igerasim Date: Sat, 17 Mar 2018 14:14:23 -0700 Subject: [PATCH] 8199547: Exception to Pattern Syntax Reviewed-by: rriggs --- src/share/classes/java/util/regex/PatternSyntaxException.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/share/classes/java/util/regex/PatternSyntaxException.java b/src/share/classes/java/util/regex/PatternSyntaxException.java index d6ac72a20..15333b1e4 100644 --- a/src/share/classes/java/util/regex/PatternSyntaxException.java +++ b/src/share/classes/java/util/regex/PatternSyntaxException.java @@ -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 @@ public class PatternSyntaxException } 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('^'); -- GitLab