-
-
Notifications
You must be signed in to change notification settings - Fork 795
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
Jackson reports wrong locations for JsonEOFException #455
Comments
Sounds plausible. Would it be possible to get a simple reproduction with test input stream and/or reader that would exhibit the problem? |
Is there any update on this, as I am currently having an issue and I can't pinpoint the issue as my JSON string of 173 characters is reporting an EOF issue at column 345 |
At this pointI will not have time to work on this any time soon. So any progress would likely be from contributions. But as importantly, please note |
With current master, here's a test case that's probably related to this:
The results are: Note that that's for a StringReader with 2 characters. |
Thank you @toddobryan! |
Added a failing unit test -- definitely seems to double up counts; I wonder if that is due to special handling of root-level values. Hope to look into this again soon; problem affects both |
Sending a pull request that includes tests for |
Thanks, but I already added tests (based on snippet above) -- but perhaps you could modify what I added, as I only tested |
Oh, my PR includes a fix. |
ahhh! Excellent. So, just one process thing in that case: unless I have asked for and received CLA, that would be needed before the first contribution. It can be found here:
and the usual mechanism is to print it, fill, sign & scan, email to |
… string at end of input Fixes the getCurrentLocation() issue by moving changes to _currInputProcessed and _currInputRowStart inside successful branch. Also includes checks for getTokenLocation() that make sure correct beginning location of tokens is reported and that getCurrentLocation() correctly reports the end of stream when reading is finished. Tests would be much nicer with parameterized tests from Junit5 since it's hard to tell which test case fails if one does. That's what the commented out print statements are for. Let me know if you'd like something different, but I originally had them separated out and forgot to add methods when I added to the enum. Also, the idea for the enum and much of the test data is from https://github.com/leadpony/jsonp-test-suite, which is also Apache 2 licensed. I had to rework the expected results because the JsonP getLocation() works very differently. Let me know if you need a CLA from the author of that project and I'll approach him.
I'll deal with the CLA later today. |
Thank you! |
@toddobryan Hi there! Sorry to bother you but I was wondering if you might be able to do this next week? Was hoping to get this in 2.10.0. |
Issue #455 getCurrentLocation() incorrect at end of input
I noticed the the locations reported for JsonEOFException are wrong for both InputStream and Reader based parsers. The values are about 2x higher than they should be. It looks like the problem is that in _loadMore for UTF8StreamJsonParser and in ReaderBasedJsonParser the value for _currInputRowStart is adjusted even if the read fails but _inputPtr is set to 0 only if the read succeeds. When the location is calculated for the exception the count from the last buffer is included in both from _inputPtr and in _currInputRowStart doubling the value.
The text was updated successfully, but these errors were encountered: