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
JsonParser.getTokenLocation() doesn't update after field names. #37
Comments
Ah. Yes, this must be a regression due to an earlier rewrite that combines parsing of field names with minimal tokenization of the following value. This was done for performance reasons, but did not consider effects for token location handling. |
(and by earlier, I mean something like 1.7 or 1.8 -- quite a while ago). |
It gets worse when the values are not the first in an object. For example:
In this case for
Please recognize no value is selected this time, and the previous |
Is this with byte- or char-backed source? Or both. |
@cowtowncoder I have just tested with the byte-backed source: |
@aborg0 Makes sense, but just wanted to verify. |
Please see my attached pull request for a fix. |
There's a unit test to repro the issue below. Basically, when you're on a FIELD_NAME token, if you call getTokenLocation() and then nextToken() and then getTokenLocation() again, you'll get the same location for both calls to getTokenLocation(), even though you've advanced to a new token.
The issue seems to be the _nextToken logic in ReaderBasedJsonParser and UTF8StreamJsonParser. When calling nextToken() on a FIELD_NAME, it calls _nextAfterName(), which updates _currToken but doesn't update _tokenInputRow and _tokenInputCol for the new token's location.
I started to try to fix it, but the _nextToken logic is spread across so much code that it looked like it'd be a pretty major surgery. Not something I'm willing to do at this point. :-)
The text was updated successfully, but these errors were encountered: