Hi

Today I faced with the following problem: string literal loses single quotation marks after I call .toStringAST(). I implemented the test reproducing the bug:

var spelExpressionParser = new SpelExpressionParser();
var expression = (SpelExpression) spelExpressionParser.parseExpression("'123''1' == '123''1'");

assertEquals("'123''1' == '123''1'", expression.getAST().toStringAST());

And it fails with the error

expected: <'123''1' == '123''1'> but was: <('123'1' == '123'1')>

As far as I am concerned this occurs due to problems in StringLiteral class and toString() implementation which uses not original string but changed one after

valueWithinQuotes = StringUtils.replace(valueWithinQuotes, "''", "'");

in public constructor.

Comment From: sbrannen

Related Issues

  • 14254

  • 28356

  • 29463

Comment From: sbrannen

This is has been fixed for Spring Framework 6.0.3 and backported to 5.3.25.