Gracefully handling new enum value with OrdinalEnum
---------------------------------------------------
Key: MSGPACK-83
URL:
http://jira.msgpack.org/browse/MSGPACK-83
Project: MessagePack
Issue Type: New Feature
Components: Java
Environment: msgpack-java 0.6.7
Reporter: Takanori Takase
Assignee: FURUHASHI Sadayuki
I'd like to propose an idea of gracefully handling new OrdinalEnum values.
In the current OrdinalEnumTemplate implementation, it first deserializes the ordinal int value and checks if the value is a valid enum array index. If the value is out of bound, then it throws MessageTypeException and the deserialization fails.
But instead of simply letting it fail, I'd like to have more control over this behavior by adding a new parameter, which allow us to gracefully skip the enum deserialization by returning null. I find this behavior useful when trying to deserialize a message produced by newer version of an app with new enum value added, by older version of an app which doesn't know about that new enum value.
I've prepared a patch (github pull-request) to allow enabling this option. It may sound evil to silently ignore things, but I believe it should be fine giving that this must be specified explicitly. Please let me know your thoughts or ideas.
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira