You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2019/05/07 11:44:50 UTC

[qpid-jms] branch master updated: QPIDJMS-454: explicitly populate the durable field if already sending a Header section

This is an automated email from the ASF dual-hosted git repository.

robbie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-jms.git


The following commit(s) were added to refs/heads/master by this push:
     new 4b1d22c  QPIDJMS-454: explicitly populate the durable field if already sending a Header section
4b1d22c is described below

commit 4b1d22ca94f9d1cf99cdd32e71d1d933a9bc617e
Author: Robbie Gemmell <ro...@apache.org>
AuthorDate: Tue May 7 12:40:47 2019 +0100

    QPIDJMS-454: explicitly populate the durable field if already sending a Header section
---
 .../org/apache/qpid/jms/provider/amqp/message/AmqpHeader.java | 11 ++++++++++-
 .../apache/qpid/jms/integration/ProducerIntegrationTest.java  |  6 +++---
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpHeader.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpHeader.java
index 844f96c..622b5e4 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpHeader.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpHeader.java
@@ -79,7 +79,16 @@ public final class AmqpHeader {
 
         if (!isDefault()) {
             result = new Header();
-            result.setDurable(durable);
+            // As we are now definitely sending a Header, always
+            // populate the durable field explicitly rather than
+            // potentially default it if false.
+            if(Boolean.TRUE.equals(durable)) {
+                result.setDurable(Boolean.TRUE);
+            }
+            else {
+                result.setDurable(Boolean.FALSE);
+            }
+
             result.setPriority(priority);
             result.setFirstAcquirer(firstAcquirer);
             result.setTtl(timeToLive);
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ProducerIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ProducerIntegrationTest.java
index 315abee..4bebb03 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ProducerIntegrationTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ProducerIntegrationTest.java
@@ -266,7 +266,7 @@ public class ProducerIntegrationTest extends QpidJmsTestCase {
     /**
      * Test that when a message is sent and the producer is set to send as NON_PERSISTENT
      * the resulting sent message has durable false, in this case due to setting the
-     * header field null (header only being sent due to Priority also being set).
+     * header field false (header is only being sent due to Priority also being set).
      *
      * @throws Exception if an error occurs during the test.
      */
@@ -285,7 +285,7 @@ public class ProducerIntegrationTest extends QpidJmsTestCase {
     /**
      * Test that when a message is sent and the send is passed NON_PERSISTENT delivery mode
      * the resulting sent message has durable false, in this case due to setting the
-     * header field null (header only being sent due to Priority also being set).
+     * header field false (header is only being sent due to Priority also being set).
      *
      * @throws Exception if an error occurs during the test.
      */
@@ -371,7 +371,7 @@ public class ProducerIntegrationTest extends QpidJmsTestCase {
             messageMatcher.setMessageAnnotationsMatcher(msgAnnotationsMatcher);
             if(setPriority) {
                 MessageHeaderSectionMatcher headerMatcher = new MessageHeaderSectionMatcher(true);
-                headerMatcher.withDurable(nullValue());
+                headerMatcher.withDurable(equalTo(false));
                 headerMatcher.withPriority(equalTo(UnsignedByte.valueOf(priority)));
 
                 messageMatcher.setHeadersMatcher(headerMatcher);


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