Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
spring-projects-issues opened this issue Nov 23, 2016 · 1 comment
Closed

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

spring-projects-issues opened this issue Nov 23, 2016 · 1 comment
Assignees
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Nov 23, 2016

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:

  • #15566 SpEL: Make EvaluationException more informative with Expression

Referenced from: commits 5ca10b1, 14eba50

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Nov 24, 2016

Juergen Hoeller commented

Back in 4.0, #15566 already attempted to include the full expression string in the exception message but failed to cover the SpelParseException and SpelEvaluationException subclasses which overrode getMessage() and exposed the simple message only...

We're including the detailed string including the quoted expression in all cases now. To be backported to 4.3.5. I'm afraid 4.2.9 should rather stay as-is since existing code may rely on the old message structure, i.e. the exception message starting with the error code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.