-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Description
hasNext() method in JsonParser provided by the Reference Implementation does not behave consistently for unterminated JSON.
Please see the following results.
| No. | JSON to parse | Result of hasNext() |
|---|---|---|
| 1 | (empty) | hasNext(); // returns true 😕 |
| 2 | { | next(); hasNext(); // throws JsonParsingException |
| 3 | {"a" | next(); next(); hasNext(); // throws JsonParsingException |
| 4 | {"a": | next(); next(); hasNext(); // returns true 😕 |
| 5 | {"a":1 | next(); next(); next(); hasNext(); // throws JsonParsingException |
| 6 | {"a":1, | next(); next(); next(); hasNext(); // returns true 😕 |
| 7 | [ | next(); hasNext(); // throws JsonParsingException |
| 8 | [1 | next(); next(); hasNext(); // throws JsonParsingException |
| 9 | [1, | next(); next(); hasNext(); // returns true 😕 |
I believe for No.1, 4, 6, and 9 case, hasNext() should throw JsonParsingException instead of returning true.
Are these correct and intended bahavior?
Metadata
Metadata
Assignees
Labels
No labels