Skip to content

Include expression string in SpelParseException [SPR-14942] #19509

@spring-projects-issues

Description

@spring-projects-issues

Caleb Cushing opened SPR-14942 and commented

SPELL parsing a valid expression, there is still more data in expression

in this exception, examples of which can be found http://stackoverflow.com/q/29534883/206466

spring will give you the column number, the problem is if you have, say a Spring Data JPA query with multiple spring expressions, figuring out what, for example column 66 is can be painful.

It would be nice if the exception included the piece of string leading up to or after. So it's easier to find in your code.

so instead of ```
Exception in thread "main" org.springframework.expression.spel.SpelParseException: EL1041E:(pos 6):


the linked SO might have had ```
Exception in thread "main" org.springframework.expression.spel.SpelParseException: EL1041E:(pos 6) at "ello"

in my case the exception was near right parens, because I had a duplicate right parens but I had 4 different spel expressions in my query, all of them using T() to wrap an enum.


Affects: 4.2.8

Issue Links:

Referenced from: commits 5ca10b1, 14eba50

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions