Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 646913

Summary: Java qpid-client ignores hostnames containing underscores
Product: Red Hat Enterprise MRG Reporter: Dominic Cleal <dcleal>
Component: qpid-javaAssignee: Rajith Attapattu <rattapat+nobody>
Status: CLOSED ERRATA QA Contact: Petr Matousek <pematous>
Severity: medium Docs Contact:
Priority: high    
Version: 1.3CC: gsim, jneedle, pematous
Target Milestone: 2.0   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: If the hostname in a broker URL contains an underscore it's being evaluated as 'localhost' rather than the intended host. Consequence: The JMS Client connection fails with "java.net.ConnectException: Connection refused" as it tries to connect to the localhost rather than the intended host. Fix: The JMS client now correctly evaluates any host name containing underscores. Result: If the hostname contains an underscore, the client now connects to the intended host.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-06-23 15:46:41 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dominic Cleal 2010-10-26 16:02:22 UTC
Description of problem:
When defining an AMQP connection via a properties file using qpid-client, listing a broker that has an underscore the hostname results in the broker host being evaluated to "localhost" rather than the intended host.

Version-Release number of selected component (if applicable):
qpid-java-0.7.946106 (MRG Messaging 1.3)

How reproducible:
Always.

Steps to Reproduce:
1. Define a connection factory with a broker hostname containing underscores, e.g. amqp://guest:guest@clientid/test?brokerlist='tcp://under_score:5672'
2. Create and start a Connection from the instantiated ConnectionFactory

Or using qpid-java client examples:
1. cp -a /usr/share/doc/qpid-java-0.7.946106/examples ./; cd examples
2. sed -i s/localhost/under_score/ org/apache/qpid/example/hello.properties
3. ./run_example.sh org.apache.qpid.example.Hello

Actual results:
java.net.ConnectException: Connection refused
(assuming no qpidd running on localhost)

Expected results:
java.net.UnknownHostException: under_score

Additional info:
main[13] where
  [13] org.apache.qpid.client.AMQConnection.<init> (AMQConnection.java:546)
  [14] org.apache.qpid.client.AMQConnectionFactory.createConnection (AMQConnectionFactory.java:276)
  [15] org.apache.qpid.example.Hello.runTest (Hello.java:51)
  [16] org.apache.qpid.example.Hello.main (Hello.java:40)
main[13] dump brokerDetails
 brokerDetails = {
    _host: ""
    _port: 5672
    _transport: "tcp"
    _options: instance of java.util.HashMap(id=1537)
    _sslConfiguration: null
}

Comment 1 Rajith Attapattu 2011-03-01 20:39:17 UTC
Fixed in upstream Qpid project
http://svn.apache.org/viewvc?rev=1076011&view=rev

Comment 2 Rajith Attapattu 2011-03-15 02:15:19 UTC
The fixes are now included in rpms from version qpid-java-0.9.1080013-2

Comment 3 Rajith Attapattu 2011-03-15 02:15:19 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:  If the hostname in a broker URL contains an underscore it's being evaluated as 'localhost' rather than the intended host.

Consequence:  The JMS Client connection fails with "java.net.ConnectException: Connection refused" as it tries to connect to the localhost rather than the intended host.


Fix:  The JMS client now correctly evaluates any host name containing underscores.

Result: If the hostname contains an underscore, the client now connects to the intended host.

Comment 4 Petr Matousek 2011-04-13 12:31:53 UTC
This issue has been fixed

Verified on RHEL4.9, RHEL5.6 and RHEL6.1, architectures: i386, x86_64

packages installed:
qpid-java-example-0.10-2.el5
qpid-java-common-0.10-2.el5
qpid-java-client-0.10-2.el5

-> VERIFIED

Comment 5 errata-xmlrpc 2011-06-23 15:46:41 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2011-0890.html