Author: ritchiem
Date: Mon Sep 10 07:46:04 2007
New Revision: 574266

URL: http://svn.apache.org/viewvc?rev=574266&view=rev
Log:
QPID-584 : Client exceptions are now presented via any set Exception Listener 

Modified:
    
incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
    
incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java
    
incubator/qpid/branches/M2.1/java/client/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionStartTest.java

Modified: 
incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java?rev=574266&r1=574265&r2=574266&view=diff
==============================================================================
--- 
incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
 (original)
+++ 
incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
 Mon Sep 10 07:46:04 2007
@@ -1114,6 +1114,10 @@
         {
             _exceptionListener.onException(je);
         }
+        else
+        {
+            _logger.error("Throwable Received but no listener set: " + 
cause.getMessage());
+        }
 
         if (!(cause instanceof AMQUndeliveredException) && !(cause instanceof 
AMQAuthenticationException))
         {

Modified: 
incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java?rev=574266&r1=574265&r2=574266&view=diff
==============================================================================
--- 
incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java
 (original)
+++ 
incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java
 Mon Sep 10 07:46:04 2007
@@ -24,6 +24,7 @@
 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;
@@ -335,6 +336,20 @@
                 // this will attemp failover
 
                 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 ...

Modified: 
incubator/qpid/branches/M2.1/java/client/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionStartTest.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/java/client/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionStartTest.java?rev=574266&r1=574265&r2=574266&view=diff
==============================================================================
--- 
incubator/qpid/branches/M2.1/java/client/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionStartTest.java
 (original)
+++ 
incubator/qpid/branches/M2.1/java/client/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionStartTest.java
 Mon Sep 10 07:46:04 2007
@@ -96,7 +96,7 @@
             // 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());
 
         }


Reply via email to