From 46251b8a6322a90715d0165845c16b377869a645 Mon Sep 17 00:00:00 2001 From: Rajith Muditha Attapattu Date: Tue, 1 Mar 2011 20:09:56 +0000 Subject: QPID-3099 Added logic to look for the 'host' in the authority field if getHost returns null. Looking at the code that follows, you could definitely make more improvements. However since we are close to the 0.10 release I'd leave things as it is for the time being. I have also added test cases to cover the issues highlighted by the respective JIRA. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1076011 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/qpid/client/AMQBrokerDetails.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'qpid/java/client/src/main') diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQBrokerDetails.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQBrokerDetails.java index ee52cd50af..b31dd2bc91 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQBrokerDetails.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQBrokerDetails.java @@ -105,6 +105,21 @@ public class AMQBrokerDetails implements BrokerDetails if (host == null) { host = ""; + + String auth = connection.getAuthority(); + if (auth != null) + { + // contains both host & port myhost:5672 + if (auth.contains(":")) + { + host = auth.substring(0,auth.indexOf(":")); + } + else + { + host = auth; + } + } + } setHost(host); -- cgit v1.2.1