diff options
| author | Martin Ritchie <ritchiem@apache.org> | 2007-09-10 14:46:04 +0000 |
|---|---|---|
| committer | Martin Ritchie <ritchiem@apache.org> | 2007-09-10 14:46:04 +0000 |
| commit | f1da3e2d93ce8c7bb950a6d83d4e5b8c3e3793f5 (patch) | |
| tree | 106f2371cd4e8b87dda603aabe43c6381117d691 /java/client/src | |
| parent | 452ccdb117a8e6e9c292bbd3daa04212ca99a785 (diff) | |
| download | qpid-python-f1da3e2d93ce8c7bb950a6d83d4e5b8c3e3793f5.tar.gz | |
QPID-584 : Client exceptions are now presented via any set Exception Listener
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/M2.1@574266 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/client/src')
3 files changed, 20 insertions, 1 deletions
diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java b/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java index 1cbf59b22a..9acc6ada0e 100644 --- a/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java +++ b/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java @@ -1114,6 +1114,10 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect { _exceptionListener.onException(je); } + else + { + _logger.error("Throwable Received but no listener set: " + cause.getMessage()); + } if (!(cause instanceof AMQUndeliveredException) && !(cause instanceof AMQAuthenticationException)) { diff --git a/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java b/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java index aac5886c80..45c9dc046e 100644 --- a/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java +++ b/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java @@ -24,6 +24,7 @@ import org.apache.mina.common.IdleStatus; import org.apache.mina.common.IoHandlerAdapter; import org.apache.mina.common.IoSession; import org.apache.mina.filter.SSLFilter; +import org.apache.mina.filter.codec.ProtocolCodecException; import org.apache.mina.filter.codec.ProtocolCodecFilter; import org.apache.qpid.AMQConnectionClosedException; @@ -336,6 +337,20 @@ public class AMQProtocolHandler extends IoHandlerAdapter sessionClosed(session); } + else + { + + if (cause instanceof ProtocolCodecException) + { + _logger.info("Protocol Exception caught NOT going to attempt failover as " + + "cause isn't AMQConnectionClosedException: " + cause, cause); + + AMQException amqe = new AMQException("Protocol handler error: " + cause, cause); + propagateExceptionToWaiters(amqe); + } + + _connection.exceptionReceived(cause); + } // FIXME Need to correctly handle other exceptions. Things like ... // if (cause instanceof AMQChannelClosedException) diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionStartTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionStartTest.java index ae8e2cfbda..daa1086561 100644 --- a/java/client/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionStartTest.java +++ b/java/client/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionStartTest.java @@ -96,7 +96,7 @@ public class ConnectionStartTest extends TestCase // should really not be called before _connection start assertTrue("There should not be messages waiting for the consumer", _consumer.receiveNoWait() == null); _connection.start(); - assertTrue("There should be messages waiting for the consumer", _consumer.receiveNoWait() == null); + assertTrue("There should be messages waiting for the consumer", _consumer.receive(1000) == null); assertTrue("Connection should be started", _connection.started()); } |
