You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Rajith Attapattu (JIRA)" <ji...@apache.org> on 2011/03/03 06:51:37 UTC

[jira] Commented: (QPID-2930) JMS msg.getPropertyNames() method should not return x-amqp-0-10.routing-key

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

Rajith Attapattu commented on QPID-2930:
----------------------------------------

The JMS specification allows any message property to be retrieved as a string.
However the the valid types are boolean, byte, short, int, long, float, double, and String.
Therefore in JMS, the property value cannot be a byte[] as it's not a valid type.

However in AMQP you are allowed to have byte arrays,lists, maps, UUID's etc.. as property values.
So a broker or a non JMS client could set such a property in a message that will be consumed by a JMS consumer.

In such a case there are two possible ways of handling it.
1) Ignore the properties (from the list provided in response to getPropertyNames() method)  that does not have a value allowed by the JMS spec.
2) Provide the standard string representation of the value.

Option #2 is fairly useless if the value is of type array, list or map.

I think option #1 is probably the best as a JMS client will not expect to receive any property with a value that is not valid as per the spec. Therefore it does not need to even know the name of a property that it cannot access.

>  JMS msg.getPropertyNames() method should not return x-amqp-0-10.routing-key
> ----------------------------------------------------------------------------
>
>                 Key: QPID-2930
>                 URL: https://issues.apache.org/jira/browse/QPID-2930
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Client
>            Reporter: Rajith Attapattu
>            Assignee: Rajith Attapattu
>            Priority: Minor
>             Fix For: 0.9
>
>
> Description of problem:
> JMS msg.getPropertyNames() method should not return x-amqp-0-10.routing-key,
> x-amqp-0-10.routing-key is internal property. It cause exception if loop via
> ProertyName enumeration. 
> Code: 
> === 
> Enumeration<String> enu = msg.getPropertyNames(); 
> while (enu.hasMoreElements()) { 
> String name = (String) enu.nextElement(); 
> String value = msg.getStringProperty(name); 
> } 
> Exception
> =========
> Caused by: javax.jms.MessageFormatException:
> getString("x-amqp-0-10.routing-key") failed as value of type class [B is an array. 
> at
> org.apache.qpid.client.message.AMQMessageDelegate_0_10.getStringProperty(AMQMessageDelegate_0_10.java:639) 
> at
> org.apache.qpid.client.message.AbstractJMSMessage.getStringProperty(AbstractJMSMessage.java:254) 

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org