johnzon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hendrik Dev <>
Subject New test cases and JsonStreamParser issues
Date Sat, 05 Jul 2014 07:53:37 GMT

i have enhanced the set of test json files [1] (and related test
cases) to make sure that the json parser works correctly and fails
correctly if json is invalid.

The current class does not pass all tests. So i
started to fix this but JsonStreamParser was hard to understand for me
and i discovered a main problem (see below) which i could not fix and
so i wrote
a new implementation (JsonByteBufferStreamParser and
JsonCharBufferStreamParser [2]). These implementations did pass all
new (and old) tests (some older tests had issues because of IMHO wrong
tests, see [3]).

The main problem with JsonStreamParser was that it fails if the last
character in char[] loadedChars, before a direct overflow, is a ending
doublequote. Than the overflow happens and something goes wrong with
preserving the previously readed value.
So if the buffer size (=org.apache.fleece.default-char-buffer) and the
json input have the right "bad" correlation then parsing would fail.
There are now testcases for this.

I did some JMH based benchmarking for the the new parser
implementations [4] (based on the ideas from [5]). They show more or
less equals figures [6] compared to the original JsonStreamParser.

Please let me know what you think about that.







Hendrik Saly (salyh, hendrikdev22)
PGP: 0x22D7F6EC

View raw message