You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2009/04/21 17:46:35 UTC

svn commit: r767193 - /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTextMessage.cpp

Author: tabish
Date: Tue Apr 21 15:46:35 2009
New Revision: 767193

URL: http://svn.apache.org/viewvc?rev=767193&view=rev
Log:
Fix the getText method to properly call the OpenWireStringSupport readString method to decode UTF-8 data.

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTextMessage.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTextMessage.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTextMessage.cpp?rev=767193&r1=767192&r2=767193&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTextMessage.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTextMessage.cpp Tue Apr 21 15:46:35 2009
@@ -16,8 +16,10 @@
  */
 #include <activemq/commands/ActiveMQTextMessage.h>
 
+#include <decaf/io/ByteArrayInputStream.h>
 #include <decaf/io/ByteArrayOutputStream.h>
 #include <decaf/io/DataOutputStream.h>
+#include <decaf/io/DataInputStream.h>
 #include <activemq/wireformat/openwire/utils/OpenwireStringSupport.h>
 
 using namespace std;
@@ -51,7 +53,10 @@
             return "";
         }
 
-        return std::string( (const char*)&getContent()[4], getContent().size()-4 );
+        decaf::io::ByteArrayInputStream bais( getContent() );
+        decaf::io::DataInputStream dataIn( &bais );
+
+        return OpenwireStringSupport::readString( dataIn );
     }
     AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
 }