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 2017/12/05 11:20:32 UTC

[1/2] qpid-broker-j git commit: QPID-8047: [Broker-J][AMQP 0-10] Fix NPE on receiving session.detach for unknown session

Repository: qpid-broker-j
Updated Branches:
  refs/heads/master 5b07dbf6b -> c2412ba4a


QPID-8047: [Broker-J][AMQP 0-10] Fix NPE on receiving session.detach for unknown session


Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/c37376a2
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/c37376a2
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/c37376a2

Branch: refs/heads/master
Commit: c37376a2a8e139893d5442266c7bcb218ab18ce8
Parents: 5b07dbf
Author: Alex Rudyy <or...@apache.org>
Authored: Tue Dec 5 11:17:23 2017 +0000
Committer: Alex Rudyy <or...@apache.org>
Committed: Tue Dec 5 11:17:23 2017 +0000

----------------------------------------------------------------------
 .../v0_10/ServerConnectionDelegate.java         | 30 ++++++++++++++------
 .../qpid/tests/protocol/v0_10/Interaction.java  |  1 +
 .../qpid/tests/protocol/v0_10/SessionTest.java  |  2 --
 3 files changed, 23 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/c37376a2/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerConnectionDelegate.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerConnectionDelegate.java b/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerConnectionDelegate.java
index cab769f..43c3bf1 100644
--- a/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerConnectionDelegate.java
+++ b/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerConnectionDelegate.java
@@ -363,17 +363,31 @@ public class ServerConnectionDelegate extends MethodDelegate<ServerConnection> i
     @Override
     public void sessionDetach(ServerConnection conn, SessionDetach dtc)
     {
-        stopAllSubscriptions(conn, dtc);
-        ServerSession ssn = conn.getSession(dtc.getChannel());
-        ssn.setClose(true);
-        ssn.sessionDetached(dtc.getName(), ssn.getDetachCode() == null? SessionDetachCode.NORMAL: ssn.getDetachCode());
-        conn.unmap(ssn);
-        ssn.closed();
+        int channel = dtc.getChannel();
+        ServerSession ssn = conn.getSession(channel);
+        if (ssn != null)
+        {
+            stopAllSubscriptions(ssn);
+            ssn.setClose(true);
+            ssn.sessionDetached(dtc.getName(),
+                                ssn.getDetachCode() == null ? SessionDetachCode.NORMAL : ssn.getDetachCode());
+            conn.unmap(ssn);
+            ssn.closed();
+        }
+        else
+        {
+            if(LOGGER.isDebugEnabled())
+            {
+                LOGGER.debug("SessionDetach received on unattached channel : {}", channel);
+            }
+            SessionDetached sessionDetached = new SessionDetached(dtc.getName(), SessionDetachCode.NOT_ATTACHED);
+            sessionDetached.setChannel(channel);
+            conn.invoke(sessionDetached);
+        }
     }
 
-    private void stopAllSubscriptions(ServerConnection conn, SessionDetach dtc)
+    private void stopAllSubscriptions(final ServerSession ssn)
     {
-        final ServerSession ssn = conn.getSession(dtc.getChannel());
         final Collection<ConsumerTarget_0_10> subs = ssn.getSubscriptions();
         for (ConsumerTarget_0_10 subscription_0_10 : subs)
         {

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/c37376a2/systests/protocol-tests-amqp-0-10/src/main/java/org/apache/qpid/tests/protocol/v0_10/Interaction.java
----------------------------------------------------------------------
diff --git a/systests/protocol-tests-amqp-0-10/src/main/java/org/apache/qpid/tests/protocol/v0_10/Interaction.java b/systests/protocol-tests-amqp-0-10/src/main/java/org/apache/qpid/tests/protocol/v0_10/Interaction.java
index 5d53a89..d636290 100644
--- a/systests/protocol-tests-amqp-0-10/src/main/java/org/apache/qpid/tests/protocol/v0_10/Interaction.java
+++ b/systests/protocol-tests-amqp-0-10/src/main/java/org/apache/qpid/tests/protocol/v0_10/Interaction.java
@@ -80,6 +80,7 @@ public class Interaction extends AbstractInteraction<Interaction>
         final BBDecoder decoder = new BBDecoder();
         decoder.init(buffer);
         dst.read(decoder);
+        dst.setChannel(src.getChannel());
         return dst;
     }
 

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/c37376a2/systests/protocol-tests-amqp-0-10/src/test/java/org/apache/qpid/tests/protocol/v0_10/SessionTest.java
----------------------------------------------------------------------
diff --git a/systests/protocol-tests-amqp-0-10/src/test/java/org/apache/qpid/tests/protocol/v0_10/SessionTest.java b/systests/protocol-tests-amqp-0-10/src/test/java/org/apache/qpid/tests/protocol/v0_10/SessionTest.java
index 51de2c2..abb88e9 100644
--- a/systests/protocol-tests-amqp-0-10/src/test/java/org/apache/qpid/tests/protocol/v0_10/SessionTest.java
+++ b/systests/protocol-tests-amqp-0-10/src/test/java/org/apache/qpid/tests/protocol/v0_10/SessionTest.java
@@ -92,8 +92,6 @@ public class SessionTest extends BrokerAdminUsingTestBase
         }
     }
 
-
-    @Ignore("QPID-8047")
     @Test
     @SpecificationTest(section = "9.session",
             description = "The transport MUST be attached in order to use any control other than"


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


[2/2] qpid-broker-j git commit: QPID-6933: [System Tests] Remove redundant assert

Posted by or...@apache.org.
QPID-6933: [System Tests] Remove redundant assert


Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/c2412ba4
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/c2412ba4
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/c2412ba4

Branch: refs/heads/master
Commit: c2412ba4a3b87117401006a77867448a6bccd8b0
Parents: c37376a
Author: Alex Rudyy <or...@apache.org>
Authored: Tue Dec 5 11:18:13 2017 +0000
Committer: Alex Rudyy <or...@apache.org>
Committed: Tue Dec 5 11:18:13 2017 +0000

----------------------------------------------------------------------
 .../apache/qpid/systests/jms_1_1/transaction/MaxDeliveryTest.java | 3 ---
 1 file changed, 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/c2412ba4/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/transaction/MaxDeliveryTest.java
----------------------------------------------------------------------
diff --git a/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/transaction/MaxDeliveryTest.java b/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/transaction/MaxDeliveryTest.java
index 1cd81d9..316c7d0 100644
--- a/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/transaction/MaxDeliveryTest.java
+++ b/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/transaction/MaxDeliveryTest.java
@@ -188,9 +188,6 @@ public class MaxDeliveryTest extends JmsTestBase
             assertTrue("Messages were not received in timely manner",
                        deliveryLatch.await(expectedNumberOfDeliveries * getReceiveTimeout(), TimeUnit.MILLISECONDS));
             assertNull("Unexpected throwable in MessageListener", messageListenerThrowable.get());
-            assertEquals("Unexpected number of total queue messages",
-                         numberOfEvenMessages,
-                         getTotalDepthOfQueuesMessages());
 
             verifyDeadLetterQueueMessages(connection, dlqName, numberOfEvenMessages);
         }


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