You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Robbie Gemmell (JIRA)" <ji...@apache.org> on 2011/03/20 00:20:29 UTC

[jira] Created: (QPID-3156) Java client implementation of the Address syntax for Destinations throws a ClassCastException when used with the documented 'True' or 'False' values for node durability

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.8, 0.7, 0.6, 0.9, 0.10
            Reporter: Robbie Gemmell
             Fix For: 0.11


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 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:dev-subscribe@qpid.apache.org


[jira] [Commented] (QPID-3156) Java client implementation of the Address syntax for Destinations throws a ClassCastException when used with the documented 'True' or 'False' values for node durability

Posted by "Rajith Attapattu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/QPID-3156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009974#comment-13009974 ] 

Rajith Attapattu commented on QPID-3156:
----------------------------------------

I've committed a fix to this on trunk. Should we port this to the 0.10 branch as well ?
IMO this is not critical as if 'true' is used instead of 'True' it will work.
We could probably release note this issue and get away with it.

> 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
>
>
> 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:dev-subscribe@qpid.apache.org


Re: [jira] [Updated] (QPID-3156) Java client implementation of the Address syntax for Destinations throws a ClassCastException when used with the documented 'True' or 'False' values for node durability

Posted by Andrew Kennedy <an...@gmail.com>.
On 24 Mar 2011, at 23:35, Robbie Gemmell wrote:
> Whilst I don't particularly disagree with including either of the  
> changes
> from a risk point of view, I don't really see this is something all  
> that
> necessary for 0.10 either.
>
> It has been this way for the past 2 releases and is thus the only  
> way anyone
> who has ever used it must have done so. I'd just update the  
> documentation
> (which needs to be done anyway due to the previous point), update  
> it for
> 0.12 and then note it can be used both ways going forward.
>
> Robbie
>
> -----Original Message-----
> From: Justin Ross [mailto:jross@redhat.com]
> Sent: 24 March 2011 23:27
> To: dev@qpid.apache.org
> Subject: Re: [jira] [Updated] (QPID-3156) Java client  
> implementation of the
> Address syntax for Destinations throws a ClassCastException when  
> used with
> the documented 'True' or 'False' values for node durability
>
> Hi, Andrew.  (Pounce!)  Do you think this change represents high  
> utility and
> low risk, and should therefore go to 0.10?

Justin,

If the tradeoff is utility against risk, then there should be no real  
issues with the changes, since the documentation is clearly  
incorrect. However, changing the *documentation* for 0.10 instead, to  
reflect the reality of the (broken) code would be simpler, and we  
could then leave the fix on trunk. This is basically what Robbie said  
above, as well.

Andrew.
-- 
-- andrew d kennedy ? do not fold, bend, spindle, or mutilate ;
-- http://grkvlt.blogspot.com/ ? edinburgh : +44 7582 293 255 ;

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


RE: [jira] [Updated] (QPID-3156) Java client implementation of the Address syntax for Destinations throws a ClassCastException when used with the documented 'True' or 'False' values for node durability

Posted by Robbie Gemmell <ro...@gmail.com>.
Whilst I don't particularly disagree with including either of the changes
from a risk point of view, I don't really see this is something all that
necessary for 0.10 either.

It has been this way for the past 2 releases and is thus the only way anyone
who has ever used it must have done so. I'd just update the documentation
(which needs to be done anyway due to the previous point), update it for
0.12 and then note it can be used both ways going forward.

Robbie

-----Original Message-----
From: Justin Ross [mailto:jross@redhat.com] 
Sent: 24 March 2011 23:27
To: dev@qpid.apache.org
Subject: Re: [jira] [Updated] (QPID-3156) Java client implementation of the
Address syntax for Destinations throws a ClassCastException when used with
the documented 'True' or 'False' values for node durability

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.jir
> a.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.ht
ml#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(Address
Helper.java:237)
>>     at
>>
org.apache.qpid.client.messaging.address.AddressHelper.fillInCommonNodeArgs(
AddressHelper.java:222)
>>     at
>>
org.apache.qpid.client.messaging.address.AddressHelper.createQueueNode(Addre
ssHelper.java:215)
>>     at
>>
org.apache.qpid.client.messaging.address.AddressHelper.getSourceNode(Address
Helper.java:254)
>>     at
>>
org.apache.qpid.client.AMQDestination.rebuildTargetAndSourceNodes(AMQDestina
tion.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:dev-subscribe@qpid.apache.org
>
>

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



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


Re: [jira] [Updated] (QPID-3156) Java client implementation of the Address syntax for Destinations throws a ClassCastException when used with the documented 'True' or 'False' values for node durability

Posted by Justin Ross <jr...@redhat.com>.
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:dev-subscribe@qpid.apache.org
>
>

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


[jira] [Updated] (QPID-3156) Java client implementation of the Address syntax for Destinations throws a ClassCastException when used with the documented 'True' or 'False' values for node durability

Posted by "Andrew Kennedy (JIRA)" <ji...@apache.org>.
     [ 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:dev-subscribe@qpid.apache.org


[jira] [Resolved] (QPID-3156) Java client implementation of the Address syntax for Destinations throws a ClassCastException when used with the documented 'True' or 'False' values for node durability

Posted by "Robbie Gemmell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/QPID-3156?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robbie Gemmell resolved QPID-3156.
----------------------------------

    Resolution: Fixed

Closing out, changes were committed long ago to address this.

> 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:dev-subscribe@qpid.apache.org


[jira] Updated: (QPID-3156) Java client implementation of the Address syntax for Destinations throws a ClassCastException when used with the documented 'True' or 'False' values for node durability

Posted by "Robbie Gemmell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/QPID-3156?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robbie Gemmell updated QPID-3156:
---------------------------------

    Description: 
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.


  was:
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 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.



> 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
>
>
> 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:dev-subscribe@qpid.apache.org


[jira] [Commented] (QPID-3156) Java client implementation of the Address syntax for Destinations throws a ClassCastException when used with the documented 'True' or 'False' values for node durability

Posted by "Justin Ross (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/QPID-3156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13010115#comment-13010115 ] 

Justin Ross commented on QPID-3156:
-----------------------------------

In my opinion, this is a worthy fix for a user gotcha and a low risk change.  I tilt in favor of merging this to 0.10, but I am keen to hear what others think.


> 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
>
>
> 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:dev-subscribe@qpid.apache.org


[jira] [Commented] (QPID-3156) Java client implementation of the Address syntax for Destinations throws a ClassCastException when used with the documented 'True' or 'False' values for node durability

Posted by "Justin Ross (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/QPID-3156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13011016#comment-13011016 ] 

Justin Ross commented on QPID-3156:
-----------------------------------

Robbie pointed out on the dev list that this behavior has existed for two releases.  To me, that makes the evident level of user gotcha much less.  Therefore the incentive to merge this to 0.10 is much less as well.  Rejected for 0.10.



> 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:dev-subscribe@qpid.apache.org


[jira] [Commented] (QPID-3156) Java client implementation of the Address syntax for Destinations throws a ClassCastException when used with the documented 'True' or 'False' values for node durability

Posted by "Rajith Attapattu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/QPID-3156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13011202#comment-13011202 ] 

Rajith Attapattu commented on QPID-3156:
----------------------------------------

As mentioned I am neutral about including it for 0.10 as there is clearly an alternative to get this working.
However we need to release note this.

> 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:dev-subscribe@qpid.apache.org


[jira] [Commented] (QPID-3156) Java client implementation of the Address syntax for Destinations throws a ClassCastException when used with the documented 'True' or 'False' values for node durability

Posted by "Rajith Attapattu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/QPID-3156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13011201#comment-13011201 ] 

Rajith Attapattu commented on QPID-3156:
----------------------------------------

Andrew,

I introduced MapAccessor precisely for that reason, and should have used it.
However I plan to clean up the code a bit more in this area and I am hoping to commit that in the coming days.
Will definitely ensure that the proper methods are used.

Rajith

> 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:dev-subscribe@qpid.apache.org