activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r767193 - /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTextMessage.cpp
Date Tue, 21 Apr 2009 15:46:35 GMT
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()
 }



Mime
View raw message