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

SpEL fails to parse nested double quotes in expressions [SPR-9620] #14254

Closed
spring-projects-issues opened this issue Jul 23, 2012 · 2 comments
Closed
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Jul 23, 2012

Sam Brannen opened SPR-9620 and commented

Status Quo

The Spring Expression Language currently supports nested single quotes within expressions but not nested double quotes.

For example, 'Wayne''s World' properly evaluates to Wayne's World, but each of the following results in an exception being thrown.

Expression Expected Result
"double quote: ""." double quote: ". SpelParseException
"double quote: ""." double quote: ". IllegalStateException

Deliverables

  1. Determine if it's appropriate for SpEL to throw an IllegalStateException in the second example above
  2. Wrap the IllegalStateException in a SpelParseException if it is determined to be an error to throw the IllegalStateException
  3. Support nested double quotes within SpEL expressions
    • using the syntax from at least one of the aforementioned failing examples, preferably from the first one for consistency with handling of single quotes

Affects: 3.0 GA, 3.1.2

@spring-projects-issues
Copy link
Collaborator Author

Andy Clement commented

Pull request that implements same behaviour for double as for single: #116

@spring-projects-issues
Copy link
Collaborator Author

Sam Brannen commented

Completed as described in the comments for GitHub commit 51bac37d9b67991bdfcbd53e0ed30a1574475bbf.

Support nested double quotes in SpEL expressions

The Spring Expression Language currently supports nested single quotes
within expressions but not nested double quotes.

The SpEL tokenizer has been modified to support nested double quotes in
the same way it supports single quotes. A sequence of two double quotes
will now be replaced by one when evaluated.

Extra error handling has also been added to report when invalid escaping
is encountered, since SpEL does not support escaping with backslash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants