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)