[ https://issues.apache.org/jira/browse/JOHNZON-112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15948577#comment-15948577 ]
Romain Manni-Bucau edited comment on JOHNZON-112 at 3/30/17 12:28 PM: ---------------------------------------------------------------------- Fixed on master. Note it was working for enums in objects but not arrays which were ignoring adapters. Test case: https://git-wip-us.apache.org/repos/asf?p=johnzon.git;a=blob;f=johnzon-mapper/src/test/java/org/apache/johnzon/mapper/CustomEnumCodecTest.java;h=0125ff420f82851ed9ca6b79441e47247b3b76f0;hb=f8d76d75969d826b0e3d046b4baed0114758e696 was (Author: romain.manni-bucau): Fixed on master. Note it was working for enums in objects but not arays which were ignoring adapters. Test case: https://git-wip-us.apache.org/repos/asf?p=johnzon.git;a=blob;f=johnzon-mapper/src/test/java/org/apache/johnzon/mapper/CustomEnumCodecTest.java;h=0125ff420f82851ed9ca6b79441e47247b3b76f0;hb=f8d76d75969d826b0e3d046b4baed0114758e696 > 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)