qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oru...@apache.org
Subject [2/2] qpid-jms-amqp-0-x git commit: QPID-8212: Throw exception only when session is not closing
Date Fri, 13 Jul 2018 10:15:53 GMT
QPID-8212: Throw exception only when session is not closing

(cherry picked from commit a48e285e3e6057cf4114ec057bffa685e3f51531)


Project: http://git-wip-us.apache.org/repos/asf/qpid-jms-amqp-0-x/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms-amqp-0-x/commit/ea1292af
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms-amqp-0-x/tree/ea1292af
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms-amqp-0-x/diff/ea1292af

Branch: refs/heads/6.3.x
Commit: ea1292afb3638ae737f7f502ece3677356a5332f
Parents: 0a9aaa6
Author: Alex Rudyy <orudyy@apache.org>
Authored: Wed Jul 11 23:10:51 2018 +0100
Committer: Alex Rudyy <orudyy@apache.org>
Committed: Fri Jul 13 11:15:31 2018 +0100

----------------------------------------------------------------------
 .../client/protocol/AMQProtocolSession.java     | 36 ++++++++++++++++++--
 1 file changed, 33 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms-amqp-0-x/blob/ea1292af/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java
b/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java
index 13c122f..bce7845 100644
--- a/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java
+++ b/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java
@@ -480,15 +480,45 @@ public class AMQProtocolSession implements AMQVersionAwareProtocolSession
     }
 
     @Override
-    public void methodFrameReceived(final int channel, final AMQMethodBody amqMethodBody)
throws QpidException
+    public void methodFrameReceived(final int channelId, final AMQMethodBody amqMethodBody)
throws QpidException
     {
         try
         {
-            _protocolHandler.methodBodyReceived(channel, amqMethodBody);
+            _protocolHandler.methodBodyReceived(channelId, amqMethodBody);
         }
         catch (IllegalStateException e)
         {
-            throw new QpidException("Unexpected exception on receiving method " + amqMethodBody,
e);
+            AMQSession session = _connection.getSession(channelId);
+            if (session == null)
+            {
+                if (isClosing(channelId))
+                {
+                    _logger.debug(
+                            "Ignoring incoming method {} of class {} on closing channel {}",
+                            amqMethodBody.getMethod(),
+                            amqMethodBody.getClazz(),
+                            channelId, e);
+                    _protocolHandler.propagateExceptionToMethodFrameListener(channelId,
+                                                                             amqMethodBody,
+                                                                             new QpidException("Session
is closing", e));
+                }
+                else
+                {
+                    throw new QpidException(String.format(
+                            "Method '%d' of class '%d' is received on unknown channel '%d'",
+                            amqMethodBody.getMethod(),
+                            amqMethodBody.getClazz(),
+                            channelId));
+                }
+            }
+            else
+            {
+                throw new QpidException(String.format(
+                        "Unexpected exception on receiving method '%d' of class '%d' on channel
'%d'",
+                        amqMethodBody.getMethod(),
+                        amqMethodBody.getClazz(),
+                        channelId), e);
+            }
         }
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message