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 19:18:00 UTC
[jira] [Resolved] (JOHNZON-185) deserialising an illegal enum value
should blow up with an Exception
[ https://issues.apache.org/jira/browse/JOHNZON-185?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mark Struberg resolved JOHNZON-185.
-----------------------------------
Resolution: Fixed
> 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
> Priority: Major
> 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)