Commit 82c7465
committed
[java] Enforce commas between JSON elements; accept trailing commas
hasNext() previously consumed a leading comma if present, but never
required one. That accepted spec-invalid inputs like '[1 2 3]' (missing
separator) and '[,1]' (leading comma). It also rejected trailing commas
like '[1,2,3,]' because it consumed the comma and then tried to read
another element.
Track whether the current container has seen an element (parallel deque
kept in sync with the container stack, marked in expect()) and use it
in hasNext() to require a comma between elements while allowing a
single trailing comma before the container's closer.1 parent 3e8e318 commit 82c7465
2 files changed
Lines changed: 86 additions & 3 deletions
File tree
- java
- src/org/openqa/selenium/json
- test/org/openqa/selenium/json
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
52 | 56 | | |
53 | 57 | | |
54 | 58 | | |
| |||
318 | 322 | | |
319 | 323 | | |
320 | 324 | | |
| 325 | + | |
| 326 | + | |
321 | 327 | | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
322 | 332 | | |
323 | | - | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
324 | 337 | | |
325 | 338 | | |
326 | 339 | | |
327 | | - | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
328 | 348 | | |
329 | 349 | | |
330 | 350 | | |
| |||
335 | 355 | | |
336 | 356 | | |
337 | 357 | | |
| 358 | + | |
338 | 359 | | |
339 | 360 | | |
340 | 361 | | |
| |||
346 | 367 | | |
347 | 368 | | |
348 | 369 | | |
| 370 | + | |
349 | 371 | | |
350 | 372 | | |
351 | 373 | | |
| |||
362 | 384 | | |
363 | 385 | | |
364 | 386 | | |
| 387 | + | |
365 | 388 | | |
366 | 389 | | |
367 | 390 | | |
| |||
373 | 396 | | |
374 | 397 | | |
375 | 398 | | |
| 399 | + | |
376 | 400 | | |
377 | 401 | | |
378 | 402 | | |
| |||
530 | 554 | | |
531 | 555 | | |
532 | 556 | | |
533 | | - | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
534 | 562 | | |
535 | 563 | | |
536 | 564 | | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
537 | 575 | | |
538 | 576 | | |
539 | 577 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
312 | 357 | | |
313 | 358 | | |
314 | 359 | | |
| |||
0 commit comments