-
Notifications
You must be signed in to change notification settings - Fork 31
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
JSON.Feature.READ_JSON_ARRAYS_AS_JAVA_ARRAYS does not work #27
Comments
Thank you for reporting this: it sounds like a bug and your code should work as you expect. |
Ok, looking at the unit test, usage that is tested is:
so a possible short-term work-around would be to use This just as a sidenote; will try to resolve the actual problem next. |
Hmmh. Interesting. Code works just fine with non-empty JSON Array -- problem only occurs with empty one. |
Well, I had the same problem with a non-empty JSON array, but since it was filled with some model objects specific to the application I was working on (rather, their JSON representation, of course) I guessed it was easier to report the bug with an empty array example. |
Turned out to be a copy+paste error for array reader; interestingly enough, only special cases of 0 and 1 elements were affected, but not larger arrays. And this is why unit tests passed; they had 2 elements in the JSON Array.... Fixed for 2.6.4. |
@gpiancastelli no that's completely fine, I was just hunting down the bug, trying to see why unit test was not catching the problem. :) |
@cowtowncoder but now that you pointed out the specifics of the bug, I double checked my "real" example, and indeed the array contained only one of those model objects I said it was filled with! Everything comes together. |
The following code, called on Jackson Jr. 2.6.3
crashes with the following exception
However, if I remove the feature and ask Jackson Jr. to read a list from the JSON array by using
listOfFrom
, everything works fine.Since even calling
arrayOfFrom
without the feature does not work (which I presume is due to JSON arrays indeed being read as JavaList
s... but, then, what's the purpose of thearrayOfFrom
method?), how else I am supposed to make Jackson Jr. return me a Java array from a JSON array?The text was updated successfully, but these errors were encountered: