diff --git a/activemq-core/src/main/java/org/apache/activemq/ActiveMQSession.java b/activemq-core/src/main/java/org/apache/activemq/ActiveMQSession.java index 2e6997dc1c..fe54fcd76e 100755 --- a/activemq-core/src/main/java/org/apache/activemq/ActiveMQSession.java +++ b/activemq-core/src/main/java/org/apache/activemq/ActiveMQSession.java @@ -1701,8 +1701,7 @@ public class ActiveMQSession implements Session, QueueSession, TopicSession, Sta TransactionId txid = transactionContext.getTransactionId(); long sequenceNumber = producer.getMessageSequence(); - //Set the "JMS" header fields on the orriginal message, see 1.1 spec section 3.4.11 - message.setJMSDestination(destination); + //Set the "JMS" header fields on the original message, see 1.1 spec section 3.4.11 message.setJMSDeliveryMode(deliveryMode); long expiration = 0L; if (!producer.getDisableMessageTimestamp()) { @@ -1728,7 +1727,8 @@ public class ActiveMQSession implements Session, QueueSession, TopicSession, Sta } //clear the brokerPath in case we are re-sending this message msg.setBrokerPath(null); - + // destination format is provider specific so only set on transformed message + msg.setJMSDestination(destination); msg.setTransactionId(txid); if (connection.isCopyMessageOnSend()) { diff --git a/activemq-core/src/test/java/org/apache/activemq/JMSMessageTest.java b/activemq-core/src/test/java/org/apache/activemq/JMSMessageTest.java index 2e596ceb94..99145b887a 100755 --- a/activemq-core/src/test/java/org/apache/activemq/JMSMessageTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/JMSMessageTest.java @@ -47,12 +47,12 @@ import org.apache.activemq.command.ActiveMQDestination; public class JMSMessageTest extends JmsTestSupport { public ActiveMQDestination destination; - public int deliveryMode; + public int deliveryMode = DeliveryMode.NON_PERSISTENT; public int prefetch; public int ackMode; - public byte destinationType; + public byte destinationType = ActiveMQDestination.QUEUE_TYPE; public boolean durableConsumer; - public String connectURL; + public String connectURL = "vm://localhost?marshal=false"; /** * Run all these tests in both marshaling and non-marshaling mode. @@ -474,7 +474,9 @@ public class JMSMessageTest extends JmsTestSupport { //validate jms spec 1.1 section 3.4.11 table 3.1 // JMSDestination, JMSDeliveryMode, JMSExpiration, JMSPriority, JMSMessageID, and JMSTimestamp //must be set by sending a message. - assertEquals(destination, message.getJMSDestination()); + + // exception for jms destination as the format is provider defined so it is only set on the copy + assertNull(message.getJMSDestination()); assertEquals(Session.AUTO_ACKNOWLEDGE, message.getJMSDeliveryMode()); assertTrue(start + timeToLive <= message.getJMSExpiration()); assertTrue(end + timeToLive >= message.getJMSExpiration());