-
-
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
NPE when parsing UTF-32 byte arrays #42
Comments
Apologies for the bug & congratulations for being the first UTF-32 user I have ever met! ;-D |
Interestingly the existing UTF-32 tested was NOT catching this issue, because it closed the stream before hitting end-of-file (which would trigger read). I was able to 'fix' this by checking for one more nextToken(). |
Fixed, now passes modified unit test. Will be in 2.1.2, 2.2.0. |
FWIW, patch fix list at: wiki.fasterxml.com/JacksonRelease212 |
Well, technically I'm not a UTF-32 user, I was just writing tests that ensured that Play framework lets Jackson detect the encoding, and included UTF-32 for completeness: We're actually still on Jackson 1.9, but it's easy enough to work around by wrapping the byte array in a ByteArrayInputStream, so we don't need this backported. |
Fair enough, I was guessing you were probably just testing UTF-32 handling for sake of completeness. :-) If work-around is easy, that's good; but if you do want a fix, 1.9 branch is still open. Actually, come to think of that now, how about I'll see if I can just add the fix myself. It should merge relatively cleanly. |
Fixed for 1.9.12 as well now. |
If you attempt to parse a UTF-32 byte array (not input stream), Jackson will throw an NPE. The bug is in here:
https://github.com/FasterXML/jackson-core/blob/master/src/main/java/com/fasterxml/jackson/core/json/ByteSourceJsonBootstrapper.java
For UTF-8 and UTF-16, a null check is done on the passed in input stream (which will be null when parsing a byte array), but for UTF-32, no null check is done, and no null check is done in UTF32Reader either.
The text was updated successfully, but these errors were encountered: