If the resulting size of repeated text in a SpEL expression (using the repeat operator *
) would exceed MAX_REPEATED_TEXT_SIZE
, we currently throw a SpelEvaluationException
with the MAX_REPEATED_TEXT_SIZE_EXCEEDED
message.
However, if the calculation of the repeated text size results in integer overflow, our max size check fails to detect that, and String#repeat(int)
throws a preemptive OutOfMemoryError
from which the application immediately recovers.
To improve diagnostics for users, we should ensure that we consistently throw a SpelEvaluationException
with the MAX_REPEATED_TEXT_SIZE_EXCEEDED
message when integer overflow occurs.