Author: nmittler Date: Thu Nov 30 20:43:01 2006 New Revision: 481149 URL: http://svn.apache.org/viewvc?view=rev&rev=481149 Log: [AMQCPP-16] Fixed bug of converting "null" replyTo field to a Destination object
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/CommandConstants.cpp incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/StompMessage.h Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/CommandConstants.cpp URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/CommandConstants.cpp?view=diff&rev=481149&r1=481148&r2=481149 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/CommandConstants.cpp (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/CommandConstants.cpp Thu Nov 30 20:43:01 2006 @@ -138,7 +138,7 @@ { throw IllegalArgumentException( __FILE__, __LINE__, - "CommandConstants::toDestionation - Not a valid Stomp Dest"); + "CommandConstants::toDestination - Not a valid Stomp Dest [%s]", dest.c_str()); } } Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/StompMessage.h URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/StompMessage.h?view=diff&rev=481149&r1=481148&r2=481149 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/StompMessage.h (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/StompMessage.h Thu Nov 30 20:43:01 2006 @@ -77,20 +77,19 @@ ackHandler( NULL ), dest( NULL ), replyTo( NULL ) - { + { + const std::string& destHeader = CommandConstants::toString( + CommandConstants::HEADER_DESTINATION ); + const std::string& replyToHeader = CommandConstants::toString( + CommandConstants::HEADER_REPLYTO ); + dest = CommandConstants::toDestination( - getPropertyValue( - CommandConstants::toString( - CommandConstants::HEADER_DESTINATION ), "" ) ); - if( getPropertyValue( - CommandConstants::toString( - CommandConstants::HEADER_REPLYTO ), "" ) != "" ) { - - replyTo = CommandConstants::toDestination( - getPropertyValue( - CommandConstants::toString( - CommandConstants::HEADER_REPLYTO ), "" ) ); - } + getPropertyValue( destHeader, "" ) ); + + std::string replyToValue = getPropertyValue( replyToHeader, "null" ); + if( replyToValue != "null" ) { + replyTo = CommandConstants::toDestination( replyToValue ); + } } virtual ~StompMessage() { delete dest; } @@ -250,9 +249,13 @@ * @return string representation of the correlation Id */ virtual std::string getCMSCorrelationId() const { - return getPropertyValue( + std::string correlationId = getPropertyValue( CommandConstants::toString( - CommandConstants::HEADER_CORRELATIONID ), "" ); + CommandConstants::HEADER_CORRELATIONID ), "null" ); + if( correlationId == "null" ){ + return ""; + } + return correlationId; } /** @@ -461,9 +464,13 @@ * @return type value */ virtual std::string getCMSMessageType() const { - return getPropertyValue( + std::string type = getPropertyValue( CommandConstants::toString( - CommandConstants::HEADER_TYPE ), "" ); + CommandConstants::HEADER_TYPE ), "null" ); + if( type == "null" ){ + return ""; + } + return type; } /**