Bug 768369

Summary: getQueueName() method on Queue object returns null
Product: Red Hat Enterprise MRG Reporter: Jiri Pechanec <jpechane>
Component: qpid-javaAssignee: Rajith Attapattu <rattapat+nobody>
Status: CLOSED CURRENTRELEASE QA Contact: ppecka <ppecka>
Severity: urgent Docs Contact:
Priority: high    
Version: DevelopmentCC: iboverma, jross, ppecka, rattapat+nobody, tross, wprice
Target Milestone: 2.1.2   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qpid-jca-0.14-6 Doc Type: Bug Fix
Doc Text:
Cause: Queue name is not set properly (when address strings are used). Consequence: getQueueName() returns null and causes NPE. Fix: The code will now try to resolve the address (where possible) to figure out the queue name from address strings. Note this does not fix all cases. Result: In most cases getQueueName() will return the proper queue name.
Story Points: ---
Clone Of:
: 838564 (view as bug list) Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 838564    
Attachments:
Description Flags
test log for new case
none
reproducer of two failing cases none

Description Jiri Pechanec 2011-12-16 13:18:57 UTC
The code
_log.info("Received text message with contents: [" + content + "] at " + new Date());
_log.info(message.getJMSDestination().toString());
_log.info("Queue name: " + ((javax.jms.Queue)message.getJMSDestination()).getQueueName());

returns

4:03:55,513 INFO  [QpidGoodByeListenerBean] Received text message with contents: [QpidHelloListenerBean received message with content: [Hello, World!] at Fri Dec 16 14:03:54 CET 2011] at Fri Dec 16 14:03:55 CET 2011
14:03:55,513 INFO  [QpidGoodByeListenerBean] 'amq.direct'/'goodbye.Queue'; None
14:03:55,514 INFO  [QpidGoodByeListenerBean] Queue name: null

This behaviour breaks TCK tests.

Comment 1 Weston M. Price 2012-01-05 13:11:28 UTC
Looking at the code, this seems to be a simple issue in that the queueName is not being parsed when we do getInfoFromAddress in the AMQDestination class. This is the JMS client so I am changing the associated component.

Comment 2 Weston M. Price 2012-01-05 16:44:05 UTC
I am changing the component back to qpid-jca since we have an easier fix on the JCA side that would be less disruptive to the JMS client and satisfies the requirement and JMS API conformance.

Comment 3 Weston M. Price 2012-01-05 20:10:22 UTC
Sigh...moving this back to qpid-java as it is indeed a JMS client issue and the JCA only fix will not work for all cases.

Comment 4 Rajith Attapattu 2012-01-25 23:27:02 UTC
Jiri,

Could you please attach the jndi properties file that you use for the tck ?

Regards,

Rajith

Comment 6 Rajith Attapattu 2012-01-26 22:22:39 UTC
This issue results in 4 TCK failures.

However there are two distinct issues here. One is where getQueueName() is called on a message we just received.
The other issue is where getQueueName is called when creating a QueueSender.

Instead of trying to fix the underlying issue in a fundamental way, I've looked at an alternative approach of fixing it on a case by case, thereby limiting the impact only to the area considered. This was done to minimize any risk to stability.

A fix for the first issues is posted upstream via QPID-3786
http://svn.apache.org/viewvc?view=rev&rev=1236355

A tactical fix for the second issue was discussed at the meeting today. Patch was emailed for feedback. This patch will not be pushed upstream.

Comment 8 Jiri Pechanec 2012-02-03 12:20:14 UTC
I have identified yet another instance
com/sun/ts/tests/jms/ee/ejb/queueCMTTests/Client.java#msgHdrJMSDestinationTest
com/sun/ts/tests/jms/ee/ejb/queueCMTTests/Client.java#msgHdrReplyToTest

Queue is into EAR's private namespace. The destionation object can be looked-up but queue name again returns null

I have modified a TCK code in common/TestsEJB.java to
    public String getDestination_1() {
        String      tmp     = null;
        try {
            TestUtil.logTrace("Getting Destination " + TESTQUEUENAME );
            Destination dest = (Destination) nctx.lookup(TESTQUEUENAME);
            tmp     = ((Queue)dest).getQueueName();
            TestUtil.logTrace("Got destination " + dest);
            TestUtil.logTrace("Got queue name " + tmp);

        } catch ( Exception e ) {
            TestUtil.logErr("Exception in getDestination_1: ", e);
        }
        return tmp;
    }


The results are
02-03-2012 07:15:54:  SVR-TRACE: Getting Destination java:comp/env/jms/MY_QUEUE
02-03-2012 07:15:54:  SVR-TRACE: Got destination 'MY_QUEUE'/None; {
  'create': 'always',
  'durable': 'true'
}
02-03-2012 07:15:54:  SVR-TRACE: Got queue name null

Comment 9 Jiri Pechanec 2012-02-03 12:22:51 UTC
Created attachment 559281 [details]
test log for new case

Comment 10 Rajith Attapattu 2012-03-12 15:36:20 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause: Queue name is not set properly (when address strings are used).

Consequence:  getQueueName() returns null and causes NPE.

Fix:  The code will now try to resolve the address (where possible) to figure out the queue name from address strings. Note this does not fix all cases.

Result: In most cases getQueueName() will return the proper queue name.

Comment 11 ppecka 2012-03-19 14:24:19 UTC
Created attachment 571138 [details]
reproducer of two failing cases

Verified on RHEL 6.2 / 5.8 ( i686 / x86_64 )
attaching reproducer of failing cases

failing cases
org.apache.qpid.example.myQueueSender
org.apache.qpid.example.JMSReplyTo

Comment 12 ppecka 2012-03-19 14:27:05 UTC
rpm -qa | grep qpid

qpid-java-client-0.14-3.el6.noarch
qpid-cpp-client-0.14-10.el6.i686
qpid-cpp-client-devel-0.14-10.el6.i686
qpid-cpp-server-store-0.14-10.el6.i686
qpid-java-common-0.14-3.el6.noarch
qpid-cpp-server-0.14-10.el6.i686
qpid-cpp-server-xml-0.14-10.el6.i686
qpid-java-example-0.14-3.el6.noarch
qpid-qmf-0.14-4.el6.i686
python-qpid-qmf-0.14-4.el6.i686
qpid-cpp-client-devel-docs-0.14-10.el6.noarch
qpid-cpp-server-cluster-0.14-10.el6.i686
python-qpid-0.14-5.el6.noarch
qpid-cpp-server-devel-0.14-10.el6.i686
qpid-jca-0.14-9.el5.noarch
qpid-tools-0.14-1.el6.noarch

--> VRIFIED