QPIDJMS-454: explicitly populate the durable field if already sending a Header section
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 @@
 
         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 @@
     /**
      * 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 @@
     /**
      * 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 @@
             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);