activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r986687 - in /activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src: main/activemq/wireformat/openwire/marshal/ test-integration/activemq/test/ test-integration/activemq/test/openwire/
Date Wed, 18 Aug 2010 14:03:22 GMT
Author: tabish
Date: Wed Aug 18 14:03:22 2010
New Revision: 986687

URL: http://svn.apache.org/viewvc?rev=986687&view=rev
Log:
fix for: https://issues.apache.org/activemq/browse/AMQCPP-312

Modified:
    activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/PrimitiveTypesMarshaller.cpp
    activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/MapMessageTest.cpp
    activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/MapMessageTest.h
    activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireMapMessageTest.h

Modified: activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/PrimitiveTypesMarshaller.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/PrimitiveTypesMarshaller.cpp?rev=986687&r1=986686&r2=986687&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/PrimitiveTypesMarshaller.cpp
(original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/PrimitiveTypesMarshaller.cpp
Wed Aug 18 14:03:22 2010
@@ -286,7 +286,9 @@ void PrimitiveTypesMarshaller::marshalPr
             std::vector<unsigned char> data = value.getByteArray();
 
             dataOut.writeInt( (int)data.size() );
-            dataOut.write( &data[0], (int)data.size() );
+			if( !data.empty() ) {
+				dataOut.write( &data[0], (int)data.size() );
+			}
 
         } else if( value.getType() == PrimitiveValueNode::STRING_TYPE ) {
 

Modified: activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/MapMessageTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/MapMessageTest.cpp?rev=986687&r1=986686&r2=986687&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/MapMessageTest.cpp
(original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/MapMessageTest.cpp
Wed Aug 18 14:03:22 2010
@@ -92,3 +92,30 @@ void MapMessageTest::testMapWithEmptyStr
     CPPUNIT_ASSERT( recvMapMessage->itemExists( "String3" ) == false );
     CPPUNIT_ASSERT( recvMapMessage->getString( "String2" ) == string( "value" ) );
 }
+
+////////////////////////////////////////////////////////////////////////////////
+void MapMessageTest::testMapSetEmptyBytesVector() {
+
+    // Create CMS Object for Comms
+    cms::Session* session( cmsProvider->getSession() );
+    cms::MessageConsumer* consumer = cmsProvider->getConsumer();
+    cms::MessageProducer* producer = cmsProvider->getProducer();
+    producer->setDeliveryMode( DeliveryMode::NON_PERSISTENT );
+
+    auto_ptr<cms::MapMessage> mapMessage( session->createMapMessage() );
+
+    std::vector<unsigned char> bytes;
+
+    mapMessage->setBytes( "BYTES", bytes );
+
+    // Send some text messages
+    producer->send( mapMessage.get() );
+
+    auto_ptr<cms::Message> message( consumer->receive( 2000 ) );
+    CPPUNIT_ASSERT( message.get() != NULL );
+
+    cms::MapMessage* recvMapMessage = dynamic_cast<MapMessage*>( message.get() );
+    CPPUNIT_ASSERT( recvMapMessage != NULL );
+    CPPUNIT_ASSERT( recvMapMessage->itemExists( "BYTES" ) == true );
+    CPPUNIT_ASSERT( recvMapMessage->getBytes( "BYTES" ).empty() == true );
+}

Modified: activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/MapMessageTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/MapMessageTest.h?rev=986687&r1=986686&r2=986687&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/MapMessageTest.h
(original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/MapMessageTest.h
Wed Aug 18 14:03:22 2010
@@ -32,6 +32,7 @@ namespace test {
 
         void testEmptyMapSendReceive();
         void testMapWithEmptyStringValue();
+        void testMapSetEmptyBytesVector();
 
     };
 

Modified: activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireMapMessageTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireMapMessageTest.h?rev=986687&r1=986686&r2=986687&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireMapMessageTest.h
(original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireMapMessageTest.h
Wed Aug 18 14:03:22 2010
@@ -30,6 +30,7 @@ namespace openwire {
         CPPUNIT_TEST_SUITE( OpenwireMapMessageTest );
         CPPUNIT_TEST( testEmptyMapSendReceive );
         CPPUNIT_TEST( testMapWithEmptyStringValue );
+        CPPUNIT_TEST( testMapSetEmptyBytesVector );
         CPPUNIT_TEST_SUITE_END();
 
     public:



Mime
View raw message