leadpony / jsonp-test-suite

Test Suite for implementations of Jakarta JSON Processing API (JSON-P)
Apache License 2.0
3 stars 2 forks source link

Empty JSON should cause an exception, according to the grammar #9

Open ssilverman opened 3 years ago

ssilverman commented 3 years ago

https://github.com/leadpony/jsonp-test-suite/blob/5efa9962d5a0452a00e8a2b2546b541991be5190/src/main/java/org/leadpony/jsonp/testsuite/tests/AbstractJsonParserTest.java#L118-L119

According to the JSON grammar, there needs to be at least one thing, be it an object, value, or array. Shouldn't a parsing exception (EOF) be thrown for these? hasNext(), in addition to next(), throws a JsonParsingException when it advances to the next event, and since the parser encounters an EOF before the next event, it's technically invalid JSON.

Ref: https://tools.ietf.org/html/rfc8259#section-2

JSON-text = ws value ws
leadpony commented 3 years ago

@ssilverman I will check it.