You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@johnzon.apache.org by "Mark Struberg (JIRA)" <ji...@apache.org> on 2018/08/29 16:26:00 UTC
[jira] [Created] (JOHNZON-185) deserialising an illegal enum value
should blow up with an Exception
Mark Struberg created JOHNZON-185:
-------------------------------------
Summary: deserialising an illegal enum value should blow up with an Exception
Key: JOHNZON-185
URL: https://issues.apache.org/jira/browse/JOHNZON-185
Project: Johnzon
Issue Type: Improvement
Components: JSON-B
Affects Versions: 1.1.8
Reporter: Mark Struberg
Assignee: Mark Struberg
Fix For: 1.1.9
Right now if we deserialise a enum value which is not know we simply set the field to null
{code}
public enum Status {ON, OFF;}
public class Engine {
private Status status;
}
json: {"status": "BLABLA"}
{code}
What I found in the spec is the following paragraph:
{noformat}
Deserialization of a JSON value into an enum instance MUST be done by calling the enum’s valueOf(String) method.
{noformat}
And valueOf should throw an IllegalArgumentException.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)