Browse Source

Fix parsing logic of function parameters with closing parentheses

Currently a function with parameter which have parentheses is wrongly parsed. As soon as a closing parentheses is encountered, the parsing logic assumes end state for the function parameter. For example, given 
`concat(sum(), 10)` then `sum(` is treated as first parameter. This is wrong parsing logic.

A parameter should be treated completely parsed only when a `,` or, the last `)` is encountered ( that is groupParen == 0)
pull/989/head
abhishek kumar tiwari 1 year ago committed by GitHub
parent
commit
46632f324d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      json-path/src/main/java/com/jayway/jsonpath/internal/path/PathCompiler.java

1
json-path/src/main/java/com/jayway/jsonpath/internal/path/PathCompiler.java

@ -353,6 +353,7 @@ public class PathCompiler {
if (0 > groupParen || priorChar == '(') {
parameter.append(c);
}
if(groupParen > 0) break;
case COMMA:
// In this state we've reach the end of a function parameter and we can pass along the parameter string
// to the parser

Loading…
Cancel
Save