8269753: Misplaced caret in PatternSyntaxException's detail message

Reviewed-by: prappo
This commit is contained in:
Ian Graves 2021-07-27 02:25:30 +00:00
parent c3d8e9228d
commit bb508e1303
2 changed files with 24 additions and 3 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2021, 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
@ -107,7 +107,9 @@ public class PatternSyntaxException
sb.append(pattern);
if (index >= 0 && pattern != null && index < pattern.length()) {
sb.append(System.lineSeparator());
for (int i = 0; i < index; i++) sb.append(' ');
for (int i = 0; i < index; i++) {
sb.append((pattern.charAt(i) == '\t') ? '\t' : ' ');
}
sb.append('^');
}
return sb.toString();