From 0c05e3263f265b90afdde25c05d59de62a41fab1 Mon Sep 17 00:00:00 2001 From: Rajith Muditha Attapattu Date: Fri, 6 Mar 2009 20:26:13 +0000 Subject: This is related to QPID-1720 The fix is a bit of a hack, but I don't see another way to handle it. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@751061 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/qpid/client/url/URLParser.java | 23 +++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'qpid/java/client/src/main') diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/url/URLParser.java b/qpid/java/client/src/main/java/org/apache/qpid/client/url/URLParser.java index fab95f754c..f3f74dd332 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/url/URLParser.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/url/URLParser.java @@ -58,22 +58,31 @@ public class URLParser if ((connection.getHost() == null) || connection.getHost().equals("")) { - String uid = AMQConnectionFactory.getUniqueClientID(); - if (uid == null) - { - throw URLHelper.parseError(-1, "Client Name not specified", fullURL); + String tmp = connection.getAuthority(); + // hack to read a clientid such as "my_clientID" + if (tmp != null && tmp.indexOf('@') < tmp.length()-1) + { + _url.setClientName(tmp.substring(tmp.indexOf('@')+1,tmp.length())); } else { - _url.setClientName(uid); + String uid = AMQConnectionFactory.getUniqueClientID(); + if (uid == null) + { + throw URLHelper.parseError(-1, "Client Name not specified", fullURL); + } + else + { + _url.setClientName(uid); + } } - } + } else { _url.setClientName(connection.getHost()); } - + String userInfo = connection.getUserInfo(); if (userInfo == null) -- cgit v1.2.1