if (object instanceof ActiveMQMessage) {
// allow setting additional properties
((ActiveMQMessage)object).setReadOnlyProperties(false);
return (Message)object;
} else {
throw new MessageConversionException("Cannot reuse object of type [" +
ObjectUtils.nullSafeClassName(object) + "] as ActiveMQMessage message. Message must already be an ActiveMQMessage.");
}
}