You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by or...@apache.org on 2018/07/13 10:14:24 UTC

qpid-jms-amqp-0-x git commit: QPID-8212: Throw exception only when session is not closing

Repository: qpid-jms-amqp-0-x
Updated Branches:
  refs/heads/master 9fe911a95 -> a48e285e3


QPID-8212: Throw exception only when session is not closing


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/a48e285e
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms-amqp-0-x/tree/a48e285e
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms-amqp-0-x/diff/a48e285e

Branch: refs/heads/master
Commit: a48e285e3e6057cf4114ec057bffa685e3f51531
Parents: 9fe911a
Author: Alex Rudyy <or...@apache.org>
Authored: Wed Jul 11 23:10:51 2018 +0100
Committer: Alex Rudyy <or...@apache.org>
Committed: Fri Jul 13 10:11:45 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/a48e285e/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