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

NPE when visiting StaticListSerializerBase #2079

Closed
WorldSEnder opened this issue Jul 2, 2018 · 1 comment
Closed

NPE when visiting StaticListSerializerBase #2079

WorldSEnder opened this issue Jul 2, 2018 · 1 comment
Milestone

Comments

@WorldSEnder
Copy link

I am using jackson 2.7 but when looking through the code, the issue will most likely remain after upgrading.

The problem has it's roots here

public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException {
acceptContentVisitor(visitor.expectArrayFormat(typeHint));
}

If the visitor returns null from expectArrayFormat (as for example by inheriting from JsonFormatVisitorWrapper.Base) then a NullPointerException will be raised from the following places

protected void acceptContentVisitor(JsonArrayFormatVisitor visitor) throws JsonMappingException {
visitor.itemsFormat(JsonFormatTypes.STRING);
}
protected void acceptContentVisitor(JsonArrayFormatVisitor visitor) throws JsonMappingException
{
visitor.itemsFormat(JsonFormatTypes.STRING);
}
.

@cowtowncoder
Copy link
Member

It would be great to have a unit test to reproduce this (and guard against regression), but I agree that compared to other handlers this probably should check for nulls.

@cowtowncoder cowtowncoder added this to the 2.9.7 milestone Aug 16, 2018
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