Skip to content

Positional parameters not detected inside SpEL expressions [DATACOUCH-616] #924

Closed
@spring-projects-issues

Description

@spring-projects-issues

Jonathan MASSUCHETTI opened DATACOUCH-616 and commented

@Query("#{#n1ql.selectEntity} WHERE #{#n1ql.filter} " +
 " #{#projectIds != null ? 'AND project IN $1' : ''} " +
 " #{#planIds != null ? 'AND ARRAY_LENGTH(ARRAY_INTERSECT(`plans`, $2)) > 0' : ''} " +
 " #{#active != null ? 'AND active = $3' : ''} " +
 " OFFSET $4 LIMIT $5")
 List<Phase> findAll(@Param("projectIds") List<String> projectIds, @Param("planIds") List<String> planIds, @Param("active") Boolean active, @Param("offset") Long offset, @Param("limit") Integer limit);

@Query("SELECT COUNT FROM #{#n1ql.bucket} WHERE #{#n1ql.filter} " +
 " #{#projectIds != null ? 'AND project IN $1 : ''} " +
 " #{#planIds != null ? 'AND ARRAY_LENGTH(ARRAY_INTERSECT(`plans`, $2)) > 0' : ''} " +
 " #{#active != null ? 'AND active = $3' : ''} ")
 Long count(@Param("projectIds") List<String> projectIds, @Param("planIds") List<String> planIds, @Param("active") Boolean active); 

 

The findAll query is correctly parsed, and receive positional parameters. OK
The count query is incorrectly parsed and crash before execution. KO

 

Error is the following :

Found non terminating string literal starting at position 252\n\tat org.springframework.expression.common.TemplateAwareExpressionParser.skipToCorrectEndSuffix(TemplateAwareExpressionParser.java:208)

 


Affects: 3.2.10 (Moore SR10)

Referenced from: pull request #265

Backported to: 4.0.5 (Neumann SR5)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions