Skip to content

Commit f3ac1a0

Browse files
committed
fail when there are multiple commas between subscriptions
1 parent 4bfa932 commit f3ac1a0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,7 @@ private boolean readBracketPropertyToken(PathTokenAppender appender) {
560560
int endPosition = 0;
561561
boolean inProperty = false;
562562
boolean inEscape = false;
563+
boolean lastSignificantWasComma = false;
563564

564565
while (path.inBounds(readPosition)) {
565566
char c = path.charAt(readPosition);
@@ -579,7 +580,13 @@ private boolean readBracketPropertyToken(PathTokenAppender appender) {
579580
} else {
580581
startPosition = readPosition + 1;
581582
inProperty = true;
583+
lastSignificantWasComma = false;
582584
}
585+
} else if (c == COMMA){
586+
if (lastSignificantWasComma){
587+
fail("Found empty property at index "+readPosition);
588+
}
589+
lastSignificantWasComma = true;
583590
}
584591
readPosition++;
585592
}

0 commit comments

Comments
 (0)