Closed MikailBag closed 1 month ago
Hi @MikailBag,
Congratulations on submitting your first issue for the Spring Framework! 👍
I consider this behavior incorrect, as
SpelExpressionParser
is documented to throw (checked)ParseException
, and not documented to throw any runtime exceptions (except maybeNullPointerException
if input isnull
).
org.springframework.expression.ParseException
is actually an unchecked RuntimeException
.
However, I agree that throwing a ParseException
(or even better a SpelParseException
) for an unsupported character would be better than throwing the IllegalStateException
, and I've updated the title of this issue to reflect that.
Cheers,
Sam
This has been fixed in c98f314665a27f88dbb8168db650c1598cafad72 for inclusion in the upcoming Spring Framework 6.1.15 release.
Reproducer: https://gist.github.com/MikailBag/ed3b036da394aae7c57e89267920f522
Actual expression:
"#{m[‘c]}"
(Please note that ‘ is not an ASCII quote)
Expected behavior: program prints "OK" (or maybe "Incorrect success", if the expression is actually correct).
Actual behavior:
I consider this behavior incorrect, as
SpelExpressionParser
is documented to throw (checked)ParseException
, and not documented to throw any runtime exceptions (except maybeNullPointerException
if input isnull
).This issue may be related to #31097.
I was able to reproduce the problem with the latest published stable version v6.1.14.