Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistency in JsonParser#hasNext() #24

Open
leadpony opened this issue Nov 10, 2020 · 0 comments
Open

Inconsistency in JsonParser#hasNext() #24

leadpony opened this issue Nov 10, 2020 · 0 comments

Comments

@leadpony
Copy link

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?

@lukasj lukasj transferred this issue from jakartaee/jsonp-api Jun 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant