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

Null Widget Received #3

Open
colbyharrison opened this issue Oct 10, 2016 · 1 comment
Open

Null Widget Received #3

colbyharrison opened this issue Oct 10, 2016 · 1 comment

Comments

@colbyharrison
Copy link

colbyharrison commented Oct 10, 2016

The parser throws an exception when receiving a response that contains a null widget.
{ "widget":null }

The exception occurs in JsonParserUtils.java, line 541. Looks like we assume reader will have a nextString() if discriminationKeyName.equals(firstName), is true.

image

Is this the expected behavior? It might be more useful to ignore the null case, and move on to the next object.

For cases such as these, should it be the responsibility of the parser to gracefully deal with null cases, or the responsibility of the server to send valid objects?

@ndtaylor
Copy link
Contributor

Yes, an exception being thrown is the expected behavior, because the widget field being null would never have happened in our case. But, I think it would be perfectly valid to change the logic to fall back to the UnknownObjectParser or return a JSONObject if the widget field is null.

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