You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Andrew Kennedy (JIRA)" <ji...@apache.org> on 2010/11/22 15:22:14 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=12934472#action_12934472 ] 

Andrew Kennedy commented on QPID-2930:
--------------------------------------

But, why are you trying to get this property value as a String in the first place?

This is a byte array, so I think the exception is correct in this circumstance. If I set *any* byte array property then the code you describe will fail in the same way. Additionally, I don't think we want to go down the road of special-casing property names to be 'hidden' from the returned enumeration of property names. I would think thst if a property is set, on the message, and *can* be retreived its name should be returned.

Finally, would it be possible, instead, to fix this by setting the value as a String in the first place? I assume this is the C++ broker, where OutgoingMessage.cpp and IncomingMessage.cpp seem to define this as const std::string X_ROUTING_KEY("x-amqp-0-10.routing-key");

>  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.
-
You can reply to this email to add a comment to the issue online.


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