Bug 704566 - 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: Rajith Attapattu
QA Contact: Zdenek Kraus
URL:
Whiteboard:
Depends On:
Blocks: 736252 738361
TreeView+ depends on / blocked
 
Reported: 2011-05-13 15:42 UTC by Rajith Attapattu
Modified: 2018-11-14 12:43 UTC (History)
5 users (show)

Fixed In Version: qpid-java-0.10-9
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 738361 (view as bug list)
Environment:
Last Closed: 2011-09-28 15:53:58 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


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

Description Rajith Attapattu 2011-05-13 15:42:51 UTC
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.

Comment 1 Rajith Attapattu 2011-08-30 18:46:52 UTC
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

Comment 2 Zdenek Kraus 2011-09-14 12:03:52 UTC
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 3 errata-xmlrpc 2011-09-28 15:53:58 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-1339.html


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