johnzon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Struberg (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (JOHNZON-185) deserialising an illegal enum value should blow up with an Exception
Date Wed, 29 Aug 2018 19:18:00 GMT

     [ 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)

Mime
View raw message