[msgpack][JIRA] Created: (MSGPACK-83) Gracefully handling new enum value with OrdinalEnum

52 views
Skip to first unread message

Takanori Takase (JIRA)

unread,
Jan 19, 2013, 2:12:13 AM1/19/13
to msgpa...@googlegroups.com
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


Muga Nishizawa (JIRA)

unread,
Jan 19, 2013, 3:04:11 AM1/19/13
to msgpa...@googlegroups.com

[ http://jira.msgpack.org/browse/MSGPACK-83?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=10508#comment-10508 ]

Muga Nishizawa commented on MSGPACK-83:
---------------------------------------

Thank you for your contacting us.

I will merge your patch on github into master branch of msgpack-java. your patch looks pretty good for me. And next time, please use github's issues:-)

Anyway, thank you again.

> 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: Muga Nishizawa
> Labels: Enum, Java

Takanori Takase (JIRA)

unread,
Jan 19, 2013, 4:12:11 AM1/19/13
to msgpa...@googlegroups.com

[ http://jira.msgpack.org/browse/MSGPACK-83?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=10509#comment-10509 ]

Takanori Takase commented on MSGPACK-83:
----------------------------------------

Thanks for your quick feedback. I was wondering whether if I should use this JIRA or the github issues. I'll use the one in github from next time.

> 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: Muga Nishizawa
> Labels: Enum, Java
>
Reply all
Reply to author
Forward
0 new messages