File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
grails-web-common/src/main/groovy/org/grails/web/json Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -467,7 +467,8 @@ public void skipPast(String to) {
467467 * @return A JSONException object, suitable for throwing
468468 */
469469 public JSONException syntaxError (String message ) {
470- return new JSONException (message + toString ());
470+
471+ return new JSONException (message + toRegexSafeString ());
471472 }
472473
473474
@@ -478,6 +479,15 @@ public JSONException syntaxError(String message) {
478479 */
479480 @ Override
480481 public String toString () {
482+ return " at character " + this .myIndex + " of " + this .mySource ;
483+ }
484+
485+ /**
486+ * Make a regex safe printable string of this JSONTokener.
487+ *
488+ * @return " at character [this.myIndex] of [this.mySource]"
489+ */
490+ public String toRegexSafeString () {
481491 int endIndex = mySource .length ();
482492 boolean appendDots = false ;
483493 if (endIndex > 20 ) {
@@ -491,6 +501,6 @@ public String toString() {
491501 output .append ("..." );
492502 }
493503 return Matcher .quoteReplacement (output .toString ());
494-
495504 }
505+
496506}
You can’t perform that action at this time.
0 commit comments