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

Alex Rudyy commented on QPID-3769:
----------------------------------

Hi Rajith,

I believe that topic address based destination should also compare the subject.
For instance the following test fails because really different destinations are 
considered to be the same:

{code:java}
    public void testEqualsForTopicDestinationsWithDifferentSubjects() throws 
Exception
    {
        AMQDestination dest1 = new AMQAnyDestination("ADDR:Foo/subjectOne; 
{node :{type:topic}}");
        AMQDestination dest2 = new AMQAnyDestination("ADDR:Foo/subjectTwo; 
{node :{type:topic}}");

        assertFalse("Destination with different subjects cannot be equal", 
dest1.equals(dest2));
    }
{code}

Also, I would like to point out that 
AMQDestinationTest#testEqaulsAndHashCodeForAddressBasedDestinations fails if it 
is ran from Eclipse because the client defaults to address based syntax and 
parsing of binding URL as address fails. I would like to suggest to prefix the 
binding destination URL in test with BURL prefix:

BURL:direct://amq.direct/test-route/Foo?routingkey='Foo'

I also noticed that both topic and queue destinations in your test are created 
using AMQQueue class. Should it possibly use AMQTopic or AMQAnyDestination?

                
> NPE in client AMQDestination.equals()
> -------------------------------------
>
>                 Key: QPID-3769
>                 URL: https://issues.apache.org/jira/browse/QPID-3769
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Client
>    Affects Versions: 0.12
>            Reporter: Jan Bareš
>            Assignee: Rajith Attapattu
>              Labels: addressing
>
> Code of org.apache.qpid.client.AMQDestination.equals(Object) is buggy, it 
> should test for null on _exchangeClass and _exchangeName before dereferencing 
> them, lines 522 and 526.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to