[jboss-jira] [JBoss JIRA] Commented: (JBMESSAGING-1749) Support null values for javax.jms.MapMessage.setObject

Howard Gao (JIRA) jira-events at lists.jboss.org
Mon Oct 26 23:49:05 EDT 2009


    [ https://jira.jboss.org/jira/browse/JBMESSAGING-1749?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12491584#action_12491584 ] 

Howard Gao commented on JBMESSAGING-1749:
-----------------------------------------

OK, I'll make it an optional behavior. If user would like null support, he need to set a system property like: mapMessage.support.null.object.

Thanks,
Howard


> Support null values for javax.jms.MapMessage.setObject
> ------------------------------------------------------
>
>                 Key: JBMESSAGING-1749
>                 URL: https://jira.jboss.org/jira/browse/JBMESSAGING-1749
>             Project: JBoss Messaging
>          Issue Type: Feature Request
>          Components: Messaging Core
>    Affects Versions: 1.4.0.SP3.CP09, 1.4.6.GA
>            Reporter: Justin Bertram
>            Assignee: Howard Gao
>             Fix For: 1.4.0.SP3.CP10, 1.4.6.GA.SP1, 1.4.7.GA
>
>
> Our implementation of javax.jms.MapMessage is org.jboss.jms.message.JBossMapMessage.  Its setObject is:
>    public void setObject(String name, Object value) throws JMSException
>    {
>       checkName(name);
>       if (value instanceof Boolean)
>          ((Map)getPayload()).put(name, value);
>       else if (value instanceof Byte)
>          ((Map)getPayload()).put(name, value);
>       else if (value instanceof Short)
>          ((Map)getPayload()).put(name, value);
>       else if (value instanceof Character)
>          ((Map)getPayload()).put(name, value);
>       else if (value instanceof Integer)
>          ((Map)getPayload()).put(name, value);
>       else if (value instanceof Long)
>          ((Map)getPayload()).put(name, value);
>       else if (value instanceof Float)
>          ((Map)getPayload()).put(name, value);
>       else if (value instanceof Double)
>          ((Map)getPayload()).put(name, value);
>       else if (value instanceof String)
>          ((Map)getPayload()).put(name, value);
>       else if (value instanceof byte[])
>          ((Map)getPayload()).put(name, ((byte[]) value).clone());
>       else
>          throw new MessageFormatException("Invalid object type.");
>    }
> Setting a null value will result in a MessageFormatException since instanceof returns false on nulls.  Although the JMS spec doesn't indicate its necessity, I think we should support setting null values (e.g. javax.jms.MapMessage.setObject("name", null)) as this is a convenience method support both by WebLogic and WebSphere.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list