- Fix for https://issues.apache.org/activemq/browse/AMQ-1576 (behavior is that if a jms property is null, it will not be converted, but will still be added to the default list of properties)

- Fix a spelling typo


git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@629060 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adrian T. Co 2008-02-19 10:46:13 +00:00
parent 8768a04e63
commit 13af1e36fb
2 changed files with 49 additions and 48 deletions

View File

@ -181,27 +181,27 @@ public final class ActiveMQMessageTransformation {
* message to the specified message * message to the specified message
* *
* @param fromMessage the message to take the properties from * @param fromMessage the message to take the properties from
* @param toMesage the message to add the properties to * @param toMessage the message to add the properties to
* @throws JMSException * @throws JMSException
*/ */
public static void copyProperties(Message fromMessage, Message toMesage) throws JMSException { public static void copyProperties(Message fromMessage, Message toMessage) throws JMSException {
toMesage.setJMSMessageID(fromMessage.getJMSMessageID()); toMessage.setJMSMessageID(fromMessage.getJMSMessageID());
toMesage.setJMSCorrelationID(fromMessage.getJMSCorrelationID()); toMessage.setJMSCorrelationID(fromMessage.getJMSCorrelationID());
toMesage.setJMSReplyTo(transformDestination(fromMessage.getJMSReplyTo())); toMessage.setJMSReplyTo(transformDestination(fromMessage.getJMSReplyTo()));
toMesage.setJMSDestination(transformDestination(fromMessage.getJMSDestination())); toMessage.setJMSDestination(transformDestination(fromMessage.getJMSDestination()));
toMesage.setJMSDeliveryMode(fromMessage.getJMSDeliveryMode()); toMessage.setJMSDeliveryMode(fromMessage.getJMSDeliveryMode());
toMesage.setJMSRedelivered(fromMessage.getJMSRedelivered()); toMessage.setJMSRedelivered(fromMessage.getJMSRedelivered());
toMesage.setJMSType(fromMessage.getJMSType()); toMessage.setJMSType(fromMessage.getJMSType());
toMesage.setJMSExpiration(fromMessage.getJMSExpiration()); toMessage.setJMSExpiration(fromMessage.getJMSExpiration());
toMesage.setJMSPriority(fromMessage.getJMSPriority()); toMessage.setJMSPriority(fromMessage.getJMSPriority());
toMesage.setJMSTimestamp(fromMessage.getJMSTimestamp()); toMessage.setJMSTimestamp(fromMessage.getJMSTimestamp());
Enumeration propertyNames = fromMessage.getPropertyNames(); Enumeration propertyNames = fromMessage.getPropertyNames();
while (propertyNames.hasMoreElements()) { while (propertyNames.hasMoreElements()) {
String name = propertyNames.nextElement().toString(); String name = propertyNames.nextElement().toString();
Object obj = fromMessage.getObjectProperty(name); Object obj = fromMessage.getObjectProperty(name);
toMesage.setObjectProperty(name, obj); toMessage.setObjectProperty(name, obj);
} }
} }
} }

View File

@ -39,8 +39,8 @@ import org.apache.activemq.util.JMSExceptionSupport;
import org.apache.activemq.util.TypeConversionSupport; import org.apache.activemq.util.TypeConversionSupport;
/** /**
* @openwire:marshaller code="23"
* @version $Revision:$ * @version $Revision:$
* @openwire:marshaller code="23"
*/ */
public class ActiveMQMessage extends Message implements org.apache.activemq.Message { public class ActiveMQMessage extends Message implements org.apache.activemq.Message {
@ -284,6 +284,7 @@ public class ActiveMQMessage extends Message implements org.apache.activemq.Mess
} }
interface PropertySetter { interface PropertySetter {
void set(Message message, Object value) throws MessageFormatException; void set(Message message, Object value) throws MessageFormatException;
} }
@ -396,7 +397,7 @@ public class ActiveMQMessage extends Message implements org.apache.activemq.Mess
checkValidObject(value); checkValidObject(value);
PropertySetter setter = JMS_PROPERTY_SETERS.get(name); PropertySetter setter = JMS_PROPERTY_SETERS.get(name);
if (setter != null) { if (setter != null && value != null) {
setter.set(this, value); setter.set(this, value);
} else { } else {
try { try {