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

Cannot read empty or singleton arrays with JSON.arrayOfFrom #40

Closed
gpiancastelli opened this issue Mar 24, 2016 · 2 comments
Closed

Cannot read empty or singleton arrays with JSON.arrayOfFrom #40

gpiancastelli opened this issue Mar 24, 2016 · 2 comments
Milestone

Comments

@gpiancastelli
Copy link

When I write:

JSON.std.with(JSON.Feature.READ_JSON_ARRAYS_AS_JAVA_ARRAYS)
        .arrayOfFrom(MyClass.class, stringContent);

my application crashes with a ClassCastException:

java.lang.ClassCastException: java.lang.Object[] cannot be cast to com.example.MyClass[]

Everything works when the array carries more than one element. I have also tested with empty arrays, and I got the same exception. I am somehow reminded of #27 where arrays featured a similarly bugged behaviour, except it involved casting an ArrayList.

@gpiancastelli gpiancastelli changed the title Cannot read singleton arrays with JSON.arrayOfFrom Cannot read empty or singleton arrays with JSON.arrayOfFrom Mar 24, 2016
@cowtowncoder
Copy link
Member

Sounds like a bug: thank you for reporting this.

@cowtowncoder cowtowncoder added this to the 2.6.6 milestone Mar 25, 2016
@cowtowncoder
Copy link
Member

Thank you for reporting this, was a quick fix. Will be in 2.6.6 and 2.7.4.

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