-
-
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
Misleading exception for input source when processing byte buffer with start offset (see JsonProcessingException
)
#652
Comments
Ah. So input source description appears to ignore offset. |
Yes, that appears to be the case. |
Ah. This will be tricky to handle -- problem is that only |
Hmmh. In theory, yes. Source reference (opaque |
JsonProcessingException
)
(moved to jackson-core since this where relevant code is, regardless of how it gets called) |
Quick notes:
|
Describe the bug
If I use the
ObjectMapper.readValue(byte[], int offset, int len, TypeReference)
interface to deserialize a value AND the deserialize fails (e.g. bad data not conforming to the expected type), the exception refers to the entire buffer rather than the buffer starting atoffset
.This leads to a misleading exception where it appears as the entire buffer is the problem, where the real problem is starting somewhere else.
This came up when processing byte buffers of JSON line separated data (so the buffer may contain more than one JSON object).
Version information
Which Jackson version(s) was this for?
2.11.0
To Reproduce
If you have a way to reproduce this with:
Stack trace with error:
Expected behavior
In this case, I would expect the exception error message to point to the start offset (here its the
["oops"]
chunk). Due to the supplied source context, the "line 1 column 1" guides the reader to point to the start of the (valid) first record in the buffer, rather than the actual problem which is line 1 column 1 in the second invalid record.Additional context
Add any other context about the problem here.
In the example, the underlying exceptions' JsonLocation looks like this:
The text was updated successfully, but these errors were encountered: