Bug 738361 - JMS Connection.getMetaData returns a usable enumeration only on the first call to getMetaData
Summary: JMS Connection.getMetaData returns a usable enumeration only on the first ca...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise MRG
Classification: Red Hat
Component: qpid-java
Version: Development
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: 2.0.3
: ---
Assignee: messaging-bugs
QA Contact: MRG Quality Engineering
URL:
Whiteboard:
Depends On: 704566
Blocks: 736252
TreeView+ depends on / blocked
 
Reported: 2011-09-14 15:38 UTC by Justin Ross
Modified: 2011-09-28 15:53 UTC (History)
7 users (show)

Fixed In Version: qpid-java-0.10-9
Doc Type: Bug Fix
Doc Text:
Clone Of: 704566
Environment:
Last Closed: 2011-09-28 15:53:32 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1340 normal SHIPPED_LIVE Red Hat Enterprise MRG Messaging 2.0.3 bug fix update 2011-09-28 15:53:05 UTC

Description Justin Ross 2011-09-14 15:38:21 UTC
+++ This bug was initially created as a clone of Bug #704566 +++

Description of problem:
JMS Connection.getMetaData returns a usable enumeration only 
on the first call to getMetaData. Invoking getMetaData multiple times, 
either on the same connection or even completely different connections 
results in a empty Enumeration.

To me more precise, after the first call to getMetaData, subsequent 
calls during the duration of the JVM, on any connection will return a 
empty Enumeration.

Looks like this is is a bug in the MRG client implementation. Debugging 
shows that org.apache.qpid.client.CustomJMSXProperty is used to return 
the metadata Enumeration. But the _names member in this class is static, 
which means that all connections get the same Enumeration object.

So, if someone gets the connection meta and iterates over the 
Enumeration, other connections see the same modified Enumeration as 
well. And because the Enumeration's pointer has already been advanced to 
the end, others are not able to get elements from the Enumeration.

How reproducible:
Always

Steps to Reproduce:
1. Run a client with the following code

Connection conn = factory.createConnection();
for (Enumeration meta = conn.getMetaData().getJMSXPropertyNames(); meta.hasMoreElements();)
{
  System.out.println(meta.nextElement());
}
            
System.out.println("Getting connection meta data again");
for (Enumeration meta = conn.getMetaData().getJMSXPropertyNames(); meta.hasMoreElements();)
{
  System.out.println(meta.nextElement());
}

2. Observe that the second time around nothing is printed, since the enumeration is empty.

  
Actual results:
If conn.getMetaData().getJMSXPropertyNames() is called a second time on the same connection or in a different connection (from the same JVM) an empty enumeration is returned.

Expected results:
Every time getJMSXPropertyNames() is called, a enumeration with the property names should be returned.

--- Additional comment from rattapat@redhat.com on 2011-08-30 14:46:52 EDT ---

This issue is tracked in upstream via https://issues.apache.org/jira/browse/QPID-3270

A fix has been committed in upstream. Details as follows.
http://svn.apache.org/viewvc?view=rev&rev=1138295
http://svn.apache.org/viewvc?view=rev&rev=1138296

--- Additional comment from zkraus@redhat.com on 2011-09-14 08:03:52 EDT ---

Fix was tested on:
RHEL 5.7 x86/x64
qpid-java-common-0.10-9.el5
qpid-java-client-0.10-9.el5
qpid-java-jca-0.10-9.el5
qpid-java-example-0.10-9.el5

RHEL 6.1 x86/x64
qpid-java-jca-0.10-9.el6.noarch
qpid-java-common-0.10-9.el6.noarch
qpid-java-example-0.10-9.el6.noarch
qpid-java-client-0.10-9.el6.noarch

changing to VERIFIED

Comment 1 errata-xmlrpc 2011-09-28 15:53:32 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2011-1340.html


Note You need to log in before you can comment on or make changes to this bug.