summaryrefslogtreecommitdiff
path: root/qpid/java/client
diff options
context:
space:
mode:
Diffstat (limited to 'qpid/java/client')
-rw-r--r--qpid/java/client/src/main/java/org/apache/qpid/client/transport/ClientConnectionDelegate.java3
-rw-r--r--qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java6
2 files changed, 4 insertions, 5 deletions
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/transport/ClientConnectionDelegate.java b/qpid/java/client/src/main/java/org/apache/qpid/client/transport/ClientConnectionDelegate.java
index 2775354acf..e9b946d5b7 100644
--- a/qpid/java/client/src/main/java/org/apache/qpid/client/transport/ClientConnectionDelegate.java
+++ b/qpid/java/client/src/main/java/org/apache/qpid/client/transport/ClientConnectionDelegate.java
@@ -98,7 +98,8 @@ public class ClientConnectionDelegate extends ClientDelegate
" Client restricted itself to : " + (restrictionList != null ? restrictionList : "no restriction"));
}
- if (CallbackHandlerRegistry.getInstance().isUserPassRequired(selectedMech))
+ if ((_connectionURL.getUsername() == null || _connectionURL.getPassword() == null)
+ && CallbackHandlerRegistry.getInstance().isUserPassRequired(selectedMech))
{
throw new ConnectionException("Username and Password is required for the selected mechanism : " + selectedMech +
" Broker allows : " + brokerMechanisms +
diff --git a/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java b/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java
index 8c193622e3..7c461fa13f 100644
--- a/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java
+++ b/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java
@@ -384,11 +384,10 @@ public class ConnectionURLTest extends TestCase
try
{
new AMQConnectionURL(url);
- fail("URL Should not parse");
}
catch (URLSyntaxException urise)
{
- assertTrue(urise.getMessage().startsWith("User information not found on url"));
+ fail("User information is optional in url");
}
}
@@ -400,11 +399,10 @@ public class ConnectionURLTest extends TestCase
try
{
new AMQConnectionURL(url);
- fail("URL Should not parse");
}
catch (URLSyntaxException urise)
{
- assertTrue(urise.getMessage().startsWith("User information not found on url"));
+ fail("User information is optional in url");
}
}