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] [Commented] (JOHNZON-112) MapperException is thrown when deserializing a customized Enum type
Date Thu, 30 Mar 2017 08:23:41 GMT

    [ https://issues.apache.org/jira/browse/JOHNZON-112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15948647#comment-15948647
] 

Mark Struberg commented on JOHNZON-112:
---------------------------------------

Steven, in which JSONP/JSONB version do you need this to work?
Romain fixed this in master which is 1.1.x and will be release soon. It targets JSONP-1.1
(EE8 level) + JSONB-1.0.

The last released johnzon version was 1.0.0 and targetted JSONP-1.0 spec (EE7 level)

Is master enough for you?

> MapperException is thrown when deserializing a customized Enum type
> -------------------------------------------------------------------
>
>                 Key: JOHNZON-112
>                 URL: https://issues.apache.org/jira/browse/JOHNZON-112
>             Project: Johnzon
>          Issue Type: Bug
>          Components: Mapper
>    Affects Versions: 1.0.0
>            Reporter: Steven Walters
>            Assignee: Romain Manni-Bucau
>             Fix For: 1.1.0
>
>         Attachments: johnzonCantDeserializeCustomEnum.zip
>
>
> Given:
> * Customized Enum type that has an alternate naming scheme than typical java Enum.name()
> * Custom Adapter between custom Enum type and String to use in serialization/deserialization
> Expectation:
> Mapper configured to use adapter uses adapter for both serialization and deserialization
operations.
> Actual:
> Mapper uses configured adapter for serialization, but uses Enum.valueOf for deserialization,
throwing Exceptions on its use.
> Root Cause Analysis:
> It seems that in MappingParserImpl.convertTo(final Type aClass, final String text)
> The custom adapter is attained successfully, but is ignored because "valueOf" method
exists with public static modifiers.
> Seems like if the adapter exists, it should be used, only using valueOf as a fallback
when it does not...
> Attaching minimal maven project that reproduces problem with "mvn test"



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message