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

JsonParser.getCurrentLocation().getByteOffset() returns wrong offset when initialized with ByteArrayInputStream #597

Closed
acadiamjh opened this issue Feb 8, 2020 · 2 comments

Comments

@acadiamjh
Copy link

acadiamjh commented Feb 8, 2020

When the JsonParser is initialized with a byte[] it seems to work in all versions back to 2.7.x (and maybe earilier). When the JsonParser is initialized with a ByteArrayInputStream it fails in 2.10.2, but works in earlier versions.

This seems to be a new issue in Jackson 2.10.2 as this was working in 2.9.10 (and several previous versions going back to at least 2.7.x). This bug was picked up in an extensive JUnit suite I run for testing out my framework after I attempted an upgrade to Jackson 2.10.2 (from 2.9.10). This is a blocker for me in that I can't upgrade past 2.9.10 until this is resolved.

I have attached a JUnit test that reproduces the issue and contains comments as well as debug statements to better explain the issue:
jackson_byte_offset_bug.zip

@cowtowncoder
Copy link
Member

Ok thank you for reporting this, providing a reproduction. I'll have a look to see which change in 2.10.x is relevant: release notes suggest #455 (added in 2.10.1) could be related but most likely it is #533 (BOM handling). BOM, 3-byte marker for UTF-8, should not count for logical content (column), but does need to be considered for byte offset I think.

@cowtowncoder
Copy link
Member

Ok, I think this is probably same as #603 and quick test supports this. Will close assuming it is the same root cause; please let me know if I made a mistake.

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

2 participants