Skip to content

Commit 01fd29f

Browse files
author
Matthew Sackman
committed
Merging bug 21238 into default
2 parents cefddb5 + a8a45d6 commit 01fd29f

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

src/com/rabbitmq/client/impl/AMQChannel.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ public static IOException wrap(ShutdownSignalException ex) {
123123
return ioe;
124124
}
125125

126+
public static IOException wrap(ShutdownSignalException ex, String message) {
127+
IOException ioe = new IOException(message, ex);
128+
return ioe;
129+
}
130+
126131
/**
127132
* Placeholder until we address bug 15786 (implementing a proper exception hierarchy).
128133
*/

src/com/rabbitmq/client/impl/AMQConnection.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,13 @@ public void start(boolean insist)
299299
new AMQImpl.Connection.StartOk(_clientProperties, "PLAIN",
300300
saslResponse, "en_US");
301301

302-
AMQP.Connection.Tune connTune =
303-
(AMQP.Connection.Tune) _channel0.exnWrappingRpc(startOk).getMethod();
302+
AMQP.Connection.Tune connTune = null;
303+
304+
try {
305+
connTune = (AMQP.Connection.Tune) _channel0.rpc(startOk).getMethod();
306+
} catch (ShutdownSignalException e) {
307+
throw AMQChannel.wrap(e, "Possibly caused by authentication failure");
308+
}
304309

305310
int channelMax =
306311
negotiatedMaxValue(factory.getRequestedChannelMax(),

test/src/com/rabbitmq/client/test/server/Permissions.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,21 @@ protected void withNames(WithName action)
138138
action.with("read");
139139
}
140140

141+
public void testAuth()
142+
{
143+
ConnectionFactory unAuthFactory = new ConnectionFactory();
144+
unAuthFactory.setUsername("test");
145+
unAuthFactory.setPassword("tset");
146+
147+
try {
148+
unAuthFactory.newConnection();
149+
fail("Exception expected if password is wrong");
150+
} catch (IOException e) {
151+
String msg = e.getMessage();
152+
assertTrue("Exception message should contain auth", msg.toLowerCase().contains("auth"));
153+
}
154+
}
155+
141156
public void testExchangeConfiguration()
142157
throws IOException
143158
{

0 commit comments

Comments
 (0)