Hi, Andrew. (Pounce!) Do you think this change represents high utility
and low risk, and should therefore go to 0.10?
On Thu, 24 Mar 2011, Andrew Kennedy (JIRA) wrote:
[
https://issues.apache.org/jira/browse/QPID-3156?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andrew Kennedy updated QPID-3156:
---------------------------------
Attachment: 0001-QPID-3156-Use-MapAccessor-to-retrieve-Boolean-proper.patch
Use existing MapAccessor code to retreive the Boolean property, as in the rest
of AddressHelper, rather than duplicating the logic.
If this is to be included in 0.10, I suggest we use this patch instead.
Java client implementation of the Address syntax for Destinations throws a
ClassCastException when used with the documented 'True' or 'False' values for
node durability
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Key: QPID-3156
URL: https://issues.apache.org/jira/browse/QPID-3156
Project: Qpid
Issue Type: Bug
Components: Java Client
Affects Versions: 0.6, 0.7, 0.8, 0.9, 0.10
Reporter: Robbie Gemmell
Fix For: 0.11
Attachments:
0001-QPID-3156-Use-MapAccessor-to-retrieve-Boolean-proper.patch
The Java client implementation of the Address syntax for destinations throws a
ClassCastException when used with the documented
(http://qpid.apache.org/books/0.8/Programming-In-Apache-Qpid/html/ch02s04.html#section-address-string-bnf)
'True' or 'False' values for node durability, instead requiring that users
specify 'true' or 'false' as the value to achieve the desired effect. The
former is parsed as a boolean value by the AddressParser whereas the later is
parsed as a String, but the AddressHelper implementation expects the durable
property to be defined as a String and casts the value as such without doing an
instanceof check after retrieving it from an untyped Map, thus leading to the
ClassCastException observed.
Ideally I would suggest the parser/helper should accept both variations going
forward, thus preserving compatibility for anyone with already functional code
and also making it possible for users to use whichever variant they prefer
because e.g. it is best suited to a particular implementation language idiom.
Reported by a user via the dev list:
I tried to create a durable queue like this
queue = queueSession.createQueue("myQueue;{create:always, node:{durable:
True}}");
QueueSender queueSender = queueSession.createSender(queue);
queueSender.send(textMessage);
and getting this exception.
Caused by: java.lang.ClassCastException: java.lang.Boolean cannot be cast to
java.lang.String
at
org.apache.qpid.client.messaging.address.AddressHelper.getDurability(AddressHelper.java:237)
at
org.apache.qpid.client.messaging.address.AddressHelper.fillInCommonNodeArgs(AddressHelper.java:222)
at
org.apache.qpid.client.messaging.address.AddressHelper.createQueueNode(AddressHelper.java:215)
at
org.apache.qpid.client.messaging.address.AddressHelper.getSourceNode(AddressHelper.java:254)
at
org.apache.qpid.client.AMQDestination.rebuildTargetAndSourceNodes(AMQDestination.java:888)
at
org.apache.qpid.client.AMQSession_0_10.resolveAddressType(AMQSession_0_10.java:1272)
thanks,
Amila.
--
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:[email protected]
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]