spring-framework/spring-expression/src
Sam Brannen 35f458fa5f Improve diagnostics for negative repeated text count in SpEL
Due to the changes in gh-31341, if the repeat count in a SpEL
expression (using the repeat operator '*') is negative, we throw a
SpelEvaluationException with the MAX_REPEATED_TEXT_SIZE_EXCEEDED
message which is incorrect and misleading.

Prior to gh-31341, a negative repeat count resulted in an
IllegalArgumentException being thrown by String#repeat(), which was
acceptable in terms of diagnostics, but that did not make it
immediately clear to the user what the underlying cause was.

In light of the above, this commit improves diagnostics for a negative
repeated text count in SpEL expressions by throwing a
SpelEvaluationException with a new NEGATIVE_REPEATED_TEXT_COUNT error
message.

Closes gh-31342
2023-09-29 17:45:21 +02:00
..
jmh/java/org/springframework/expression/spel
main/java/org/springframework/expression Improve diagnostics for negative repeated text count in SpEL 2023-09-29 17:45:21 +02:00
test Improve diagnostics for negative repeated text count in SpEL 2023-09-29 17:45:21 +02:00