activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r506181 - /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/BaseDataStreamMarshaller.cpp
Date Sun, 11 Feb 2007 23:47:02 GMT
Author: tabish
Date: Sun Feb 11 15:47:01 2007
New Revision: 506181

URL: http://svn.apache.org/viewvc?view=rev&rev=506181
Log:
http://issues.apache.org/activemq/browse/AMQCPP-30

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/BaseDataStreamMarshaller.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/BaseDataStreamMarshaller.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/BaseDataStreamMarshaller.cpp?view=diff&rev=506181&r1=506180&r2=506181
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/BaseDataStreamMarshaller.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/BaseDataStreamMarshaller.cpp
Sun Feb 11 15:47:01 2007
@@ -44,10 +44,10 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 commands::DataStructure* BaseDataStreamMarshaller::tightUnmarshalCachedObject(
-    OpenWireFormat* wireFormat, 
+    OpenWireFormat* wireFormat,
     io::DataInputStream* dataIn,
     utils::BooleanStream* bs ) throw ( io::IOException ) {
-    
+
     try{
         return wireFormat->tightUnmarshalNestedObject( dataIn, bs );
     }
@@ -57,14 +57,14 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-int BaseDataStreamMarshaller::tightMarshalCachedObject1( 
-    OpenWireFormat* wireFormat, 
-    commands::DataStructure* data, 
-    utils::BooleanStream* bs ) 
+int BaseDataStreamMarshaller::tightMarshalCachedObject1(
+    OpenWireFormat* wireFormat,
+    commands::DataStructure* data,
+    utils::BooleanStream* bs )
         throw ( io::IOException ) {
-             
+
     try{
-        return wireFormat->tightMarshalNestedObject1( data, bs ); 
+        return wireFormat->tightMarshalNestedObject1( data, bs );
     }
     AMQ_CATCH_RETHROW( IOException )
     AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, IOException )
@@ -72,13 +72,13 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void BaseDataStreamMarshaller::tightMarshalCachedObject2( 
-    OpenWireFormat* wireFormat, 
-    commands::DataStructure* data, 
-    io::DataOutputStream* dataOut, 
-    utils::BooleanStream* bs ) 
+void BaseDataStreamMarshaller::tightMarshalCachedObject2(
+    OpenWireFormat* wireFormat,
+    commands::DataStructure* data,
+    io::DataOutputStream* dataOut,
+    utils::BooleanStream* bs )
         throw ( io::IOException ) {
-            
+
     try{
         wireFormat->tightMarshalNestedObject2( data, dataOut, bs );
     }
@@ -88,12 +88,12 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void BaseDataStreamMarshaller::looseMarshalCachedObject( 
-    OpenWireFormat* wireFormat, 
-    commands::DataStructure* data, 
-    io::DataOutputStream* dataOut ) 
+void BaseDataStreamMarshaller::looseMarshalCachedObject(
+    OpenWireFormat* wireFormat,
+    commands::DataStructure* data,
+    io::DataOutputStream* dataOut )
         throw ( io::IOException ) {
-            
+
     try{
         wireFormat->looseMarshalNestedObject( data, dataOut );
     }
@@ -103,12 +103,12 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-commands::DataStructure* BaseDataStreamMarshaller::looseUnmarshalCachedObject( 
-    OpenWireFormat* wireFormat, 
+commands::DataStructure* BaseDataStreamMarshaller::looseUnmarshalCachedObject(
+    OpenWireFormat* wireFormat,
     io::DataInputStream* dataIn ) throw ( io::IOException ) {
-        
+
     try{
-        return wireFormat->looseUnmarshalNestedObject( dataIn ); 
+        return wireFormat->looseUnmarshalNestedObject( dataIn );
     }
     AMQ_CATCH_RETHROW( IOException )
     AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, IOException )
@@ -116,26 +116,26 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-int BaseDataStreamMarshaller::tightMarshalNestedObject1( 
-    OpenWireFormat* wireFormat, 
-    commands::DataStructure* object, 
-    utils::BooleanStream* bs ) 
+int BaseDataStreamMarshaller::tightMarshalNestedObject1(
+    OpenWireFormat* wireFormat,
+    commands::DataStructure* object,
+    utils::BooleanStream* bs )
         throw ( io::IOException ) {
-             
+
     try{
-        return wireFormat->tightMarshalNestedObject1( object, bs ); 
+        return wireFormat->tightMarshalNestedObject1( object, bs );
     }
     AMQ_CATCH_RETHROW( IOException )
     AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, IOException )
     AMQ_CATCHALL_THROW( IOException )
-} 
+}
 
 ////////////////////////////////////////////////////////////////////////////////
-void BaseDataStreamMarshaller::tightMarshalNestedObject2( 
-    OpenWireFormat* wireFormat, 
-    commands::DataStructure* object, 
-    io::DataOutputStream* dataOut, 
-    utils::BooleanStream* bs ) 
+void BaseDataStreamMarshaller::tightMarshalNestedObject2(
+    OpenWireFormat* wireFormat,
+    commands::DataStructure* object,
+    io::DataOutputStream* dataOut,
+    utils::BooleanStream* bs )
         throw ( io::IOException ) {
 
     try{
@@ -150,11 +150,11 @@
 commands::DataStructure* BaseDataStreamMarshaller::tightUnmarshalNestedObject(
     OpenWireFormat* wireFormat,
     io::DataInputStream* dataIn,
-    utils::BooleanStream* bs ) 
+    utils::BooleanStream* bs )
         throw ( io::IOException ) {
-         
+
     try{
-        return wireFormat->tightUnmarshalNestedObject( dataIn, bs ); 
+        return wireFormat->tightUnmarshalNestedObject( dataIn, bs );
     }
     AMQ_CATCH_RETHROW( IOException )
     AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, IOException )
@@ -162,13 +162,13 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-commands::DataStructure* BaseDataStreamMarshaller::looseUnmarshalNestedObject( 
+commands::DataStructure* BaseDataStreamMarshaller::looseUnmarshalNestedObject(
     OpenWireFormat* wireFormat,
-    io::DataInputStream* dataIn ) 
-        throw ( io::IOException ) { 
-    
+    io::DataInputStream* dataIn )
+        throw ( io::IOException ) {
+
     try{
-        return wireFormat->looseUnmarshalNestedObject( dataIn ); 
+        return wireFormat->looseUnmarshalNestedObject( dataIn );
     }
     AMQ_CATCH_RETHROW( IOException )
     AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, IOException )
@@ -176,12 +176,12 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void BaseDataStreamMarshaller::looseMarshalNestedObject( 
-    OpenWireFormat* wireFormat, 
-    commands::DataStructure* object, 
-    io::DataOutputStream* dataOut ) 
+void BaseDataStreamMarshaller::looseMarshalNestedObject(
+    OpenWireFormat* wireFormat,
+    commands::DataStructure* object,
+    io::DataOutputStream* dataOut )
         throw ( io::IOException ) {
-            
+
     try{
         wireFormat->looseMarshalNestedObject( object, dataOut );
     }
@@ -191,12 +191,12 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-std::string BaseDataStreamMarshaller::tightUnmarshalString( 
-    io::DataInputStream* dataIn, 
+std::string BaseDataStreamMarshaller::tightUnmarshalString(
+    io::DataInputStream* dataIn,
     utils::BooleanStream* bs ) throw ( io::IOException ) {
 
     try{
-        
+
         if( bs->readBoolean() ) {
 
             if (bs->readBoolean() ) {
@@ -214,22 +214,22 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-int BaseDataStreamMarshaller::tightMarshalString1( const std::string& value, 
-                                                   utils::BooleanStream* bs ) 
+int BaseDataStreamMarshaller::tightMarshalString1( const std::string& value,
+                                                   utils::BooleanStream* bs )
                                                     throw ( io::IOException ) {
     try{
-        
+
         bs->writeBoolean( value != "" );
         if( value != "" )
         {
             size_t strlen = value.length();
-            
+
             int utflen = 0;
             int c = 0;
             bool isOnlyAscii = true;
-            
+
             for( size_t i = 0; i < strlen; ++i ) {
-                
+
                 c = value[i];
                 if( (c >= 0x0001) && (c <= 0x007F) )  // ASCII char
                 {
@@ -246,16 +246,16 @@
                     utflen += 2;
                 }
             }
-            
+
             if( utflen >= 0x10000 ) {
                 throw IOException(
                     __FILE__, __LINE__,
                     "BaseDataStreamMarshaller::tightMarshalString1 - "
                     "Encountered a String value that is too long to encode." );
             }
-            
+
             bs->writeBoolean( isOnlyAscii );
-            
+
             return utflen + 2;
         }
         else
@@ -269,9 +269,9 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void BaseDataStreamMarshaller::tightMarshalString2( 
-    const std::string& value, 
-    io::DataOutputStream* dataOut, 
+void BaseDataStreamMarshaller::tightMarshalString2(
+    const std::string& value,
+    io::DataOutputStream* dataOut,
     utils::BooleanStream* bs ) throw ( io::IOException ) {
 
     try{
@@ -293,12 +293,12 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void BaseDataStreamMarshaller::looseMarshalString( 
-    const std::string value, 
+void BaseDataStreamMarshaller::looseMarshalString(
+    const std::string value,
     io::DataOutputStream* dataOut ) throw ( io::IOException ) {
-        
+
     try{
-        
+
         dataOut->writeBoolean( value != "" );
         if( value != "" )
         {
@@ -309,11 +309,11 @@
     AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, IOException )
     AMQ_CATCHALL_THROW( IOException )
 }
-                                 
+
 ////////////////////////////////////////////////////////////////////////////////
-std::string BaseDataStreamMarshaller::looseUnmarshalString( 
+std::string BaseDataStreamMarshaller::looseUnmarshalString(
     io::DataInputStream* dataIn ) throw ( io::IOException ) {
-        
+
     try{
         if( dataIn->readBoolean() ) {
             return dataIn->readUTF();
@@ -327,13 +327,13 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-int BaseDataStreamMarshaller::tightMarshalLong1( OpenWireFormat* wireFormat AMQCPP_UNUSED,

+int BaseDataStreamMarshaller::tightMarshalLong1( OpenWireFormat* wireFormat AMQCPP_UNUSED,
                                                  long long value,
-                                                 utils::BooleanStream* bs ) 
+                                                 utils::BooleanStream* bs )
                                                     throw ( io::IOException ) {
 
     try{
-        
+
         if( value == 0L )
         {
             bs->writeBoolean( false );
@@ -369,13 +369,13 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void BaseDataStreamMarshaller::tightMarshalLong2( OpenWireFormat* wireFormat AMQCPP_UNUSED,

-                                                  long long value, 
-                                                  io::DataOutputStream* dataOut, 
-                                                  utils::BooleanStream* bs ) 
+void BaseDataStreamMarshaller::tightMarshalLong2( OpenWireFormat* wireFormat AMQCPP_UNUSED,
+                                                  long long value,
+                                                  io::DataOutputStream* dataOut,
+                                                  utils::BooleanStream* bs )
                                                     throw ( io::IOException ) {
     try{
-        
+
         if( bs->readBoolean() ) {
 
             if( bs->readBoolean() ) {
@@ -383,9 +383,9 @@
             } else {
                 dataOut->writeInt( (int)value );
             }
-            
+
         } else {
-            
+
             if( bs->readBoolean() ) {
                 dataOut->writeShort( (short)value );
             }
@@ -397,23 +397,23 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-long long BaseDataStreamMarshaller::tightUnmarshalLong( 
-    OpenWireFormat* wireFormat AMQCPP_UNUSED, 
-    io::DataInputStream* dataIn, 
-    utils::BooleanStream* bs ) 
+long long BaseDataStreamMarshaller::tightUnmarshalLong(
+    OpenWireFormat* wireFormat AMQCPP_UNUSED,
+    io::DataInputStream* dataIn,
+    utils::BooleanStream* bs )
         throw ( io::IOException ) {
 
     try{
         if( bs->readBoolean() ) {
-            
+
             if( bs->readBoolean() ) {
                 return dataIn->readLong();
             } else {
                 return dataIn->readInt();
             }
-            
+
         } else {
-            
+
             if( bs->readBoolean()) {
                 return dataIn->readShort();
             } else {
@@ -427,9 +427,9 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void BaseDataStreamMarshaller::looseMarshalLong( OpenWireFormat* wireFormat AMQCPP_UNUSED,

-                                                 long long value, 
-                                                 io::DataOutputStream* dataOut ) 
+void BaseDataStreamMarshaller::looseMarshalLong( OpenWireFormat* wireFormat AMQCPP_UNUSED,
+                                                 long long value,
+                                                 io::DataOutputStream* dataOut )
                                                     throw ( io::IOException ) {
 
     try{
@@ -441,13 +441,13 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-long long BaseDataStreamMarshaller::looseUnmarshalLong( 
-    OpenWireFormat* wireFormat AMQCPP_UNUSED, 
-    io::DataInputStream* dataIn ) 
-        throw ( io::IOException ) { 
+long long BaseDataStreamMarshaller::looseUnmarshalLong(
+    OpenWireFormat* wireFormat AMQCPP_UNUSED,
+    io::DataInputStream* dataIn )
+        throw ( io::IOException ) {
 
     try{
-        
+
         return dataIn->readLong();
     }
     AMQ_CATCH_RETHROW( IOException )
@@ -456,9 +456,9 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-commands::DataStructure* BaseDataStreamMarshaller::tightUnmarshalBrokerError( 
-    OpenWireFormat* wireFormat, 
-    io::DataInputStream* dataIn, 
+commands::DataStructure* BaseDataStreamMarshaller::tightUnmarshalBrokerError(
+    OpenWireFormat* wireFormat,
+    io::DataInputStream* dataIn,
     utils::BooleanStream* bs ) throw ( io::IOException ) {
 
     try{
@@ -466,20 +466,20 @@
         if( bs->readBoolean() )
         {
             BrokerError* answer = new BrokerError();
-            
+
             answer->setExceptionClass( tightUnmarshalString( dataIn, bs ) );
             answer->setMessage( tightUnmarshalString( dataIn, bs ) );
-            
+
             if( wireFormat->isStackTraceEnabled() )
             {
                 short length = dataIn->readShort();
                 std::vector< BrokerError::StackTraceElement* > stackTrace;
-                
+
                 for( int i = 0; i < length; ++i )
                 {
-                    BrokerError::StackTraceElement* element = 
+                    BrokerError::StackTraceElement* element =
                         new BrokerError::StackTraceElement;
-                    
+
                     element->ClassName = tightUnmarshalString( dataIn, bs );
                     element->MethodName = tightUnmarshalString( dataIn, bs );
                     element->FileName = tightUnmarshalString( dataIn, bs );
@@ -487,7 +487,7 @@
                     stackTrace.push_back( element );
                 }
                 answer->setStackTraceElements( stackTrace );
-                answer->setCause( dynamic_cast<BrokerError*>( 
+                answer->setCause( dynamic_cast<BrokerError*>(
                     tightUnmarshalBrokerError( wireFormat, dataIn, bs ) ) );
             }
             return answer;
@@ -501,37 +501,37 @@
     AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, IOException )
     AMQ_CATCHALL_THROW( IOException )
 }
-    
+
 ////////////////////////////////////////////////////////////////////////////////
-int BaseDataStreamMarshaller::tightMarshalBrokerError1( 
-    OpenWireFormat* wireFormat, 
-    commands::DataStructure* data, 
-    utils::BooleanStream* bs ) 
-        throw ( io::IOException ) 
+int BaseDataStreamMarshaller::tightMarshalBrokerError1(
+    OpenWireFormat* wireFormat,
+    commands::DataStructure* data,
+    utils::BooleanStream* bs )
+        throw ( io::IOException )
 {
     try{
 
         BrokerError* error = dynamic_cast<BrokerError*>( data );
 
         if( error == NULL ) {
-            
+
             bs->writeBoolean( false );
             return 0;
-            
+
         } else {
-            
+
             int rc = 0;
             bs->writeBoolean( true );
             rc += tightMarshalString1( error->getExceptionClass(), bs );
             rc += tightMarshalString1( error->getMessage(), bs );
-            
+
             if( wireFormat->isStackTraceEnabled() ) {
 
                 rc += 2;
-                
+
                 for( unsigned int i = 0; i < error->getStackTraceElements().size();
++i ) {
-                    
-                    const BrokerError::StackTraceElement* element = 
+
+                    const BrokerError::StackTraceElement* element =
                         error->getStackTraceElements()[i];
                     rc += tightMarshalString1( element->ClassName, bs );
                     rc += tightMarshalString1( element->MethodName, bs );
@@ -540,7 +540,7 @@
                 }
                 rc += tightMarshalBrokerError1( wireFormat, error->getCause(), bs );
             }
-            
+
             return rc;
         }
     }
@@ -548,89 +548,89 @@
     AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, IOException )
     AMQ_CATCHALL_THROW( IOException )
 }
-                                      
+
 ////////////////////////////////////////////////////////////////////////////////
-void BaseDataStreamMarshaller::tightMarshalBrokerError2( 
-    OpenWireFormat* wireFormat, 
-    commands::DataStructure* data, 
-    io::DataOutputStream* dataOut, 
+void BaseDataStreamMarshaller::tightMarshalBrokerError2(
+    OpenWireFormat* wireFormat,
+    commands::DataStructure* data,
+    io::DataOutputStream* dataOut,
     utils::BooleanStream* bs )
         throw ( io::IOException ) {
 
     try{
 
         if( bs->readBoolean() ) {
-            
+
             BrokerError* error = dynamic_cast<BrokerError*>( data );
-            
+
             tightMarshalString2( error->getExceptionClass(), dataOut, bs );
             tightMarshalString2( error->getMessage(), dataOut, bs );
-            
+
             if( wireFormat->isStackTraceEnabled() ) {
-                
+
                 int length = (short)error->getStackTraceElements().size();
                 dataOut->writeShort( (short)length );
-                
+
                 for( int i = 0; i < length; ++i ) {
-                    
-                    BrokerError::StackTraceElement* element = 
+
+                    BrokerError::StackTraceElement* element =
                         error->getStackTraceElements()[i];
-                        
+
                     tightMarshalString2( element->ClassName, dataOut, bs );
                     tightMarshalString2( element->MethodName, dataOut, bs );
                     tightMarshalString2( element->FileName, dataOut, bs );
                     dataOut->writeInt( element->LineNumber );
                 }
-                
-                tightMarshalBrokerError2( 
+
+                tightMarshalBrokerError2(
                     wireFormat, error->getCause(), dataOut, bs );
             }
-        }        
+        }
     }
     AMQ_CATCH_RETHROW( IOException )
     AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, IOException )
     AMQ_CATCHALL_THROW( IOException )
 }
-                                       
+
 ////////////////////////////////////////////////////////////////////////////////
-commands::DataStructure* BaseDataStreamMarshaller::looseUnmarshalBrokerError( 
-    OpenWireFormat* wireFormat, 
-    io::DataInputStream* dataIn ) 
-        throw ( io::IOException ) { 
+commands::DataStructure* BaseDataStreamMarshaller::looseUnmarshalBrokerError(
+    OpenWireFormat* wireFormat,
+    io::DataInputStream* dataIn )
+        throw ( io::IOException ) {
 
     try{
-        
+
         if( dataIn->readBoolean() ) {
-            
+
             BrokerError* answer = new BrokerError();
-            
+
             answer->setExceptionClass( looseUnmarshalString( dataIn ) );
             answer->setMessage( looseUnmarshalString( dataIn ) );
-            
+
             if( wireFormat->isStackTraceEnabled() ) {
-                
+
                 short length = dataIn->readShort();
                 std::vector< BrokerError::StackTraceElement* > stackTrace;
-                
+
                 for( int i = 0; i < length; ++i ) {
-                    
-                    BrokerError::StackTraceElement* element = 
+
+                    BrokerError::StackTraceElement* element =
                         new BrokerError::StackTraceElement;
-                    
+
                     element->ClassName = looseUnmarshalString( dataIn );
                     element->MethodName = looseUnmarshalString( dataIn );
                     element->FileName = looseUnmarshalString( dataIn );
                     element->LineNumber = dataIn->readInt();
-                    
+
                     stackTrace.push_back( element );
                 }
                 answer->setStackTraceElements( stackTrace );
                 answer->setCause( dynamic_cast<BrokerError*>(
                     looseUnmarshalBrokerError( wireFormat, dataIn ) ) );
             }
-            
+
             return answer;
-            
+
         } else {
             return NULL;
         }
@@ -639,43 +639,43 @@
     AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, IOException )
     AMQ_CATCHALL_THROW( IOException )
 }
-    
+
 ////////////////////////////////////////////////////////////////////////////////
-void BaseDataStreamMarshaller::looseMarshalBrokerError( 
-    OpenWireFormat* wireFormat, 
-    commands::DataStructure* data, 
-    io::DataOutputStream* dataOut ) 
+void BaseDataStreamMarshaller::looseMarshalBrokerError(
+    OpenWireFormat* wireFormat,
+    commands::DataStructure* data,
+    io::DataOutputStream* dataOut )
         throw ( io::IOException ) {
 
     try{
-        
+
         BrokerError* error = dynamic_cast<BrokerError*>( data );
-        
+
         dataOut->write( error != NULL );
-        
+
         if( error != NULL ){
-            
+
             looseMarshalString( error->getExceptionClass(), dataOut );
             looseMarshalString( error->getMessage(), dataOut );
-            
+
             if( wireFormat->isStackTraceEnabled() ) {
-                
+
                 size_t length = error->getStackTraceElements().size();
-                
+
                 dataOut->writeShort( (short)length );
-                
+
                 for( size_t i = 0; i < length; ++i ) {
-                    
-                    BrokerError::StackTraceElement* element = 
+
+                    BrokerError::StackTraceElement* element =
                         error->getStackTraceElements()[i];
-                        
+
                     looseMarshalString( element->ClassName, dataOut );
                     looseMarshalString( element->MethodName, dataOut );
                     looseMarshalString( element->FileName, dataOut );
-                    
+
                     dataOut->writeInt( element->LineNumber );
                 }
-                
+
                 looseMarshalBrokerError( wireFormat, error->getCause(), dataOut );
             }
         }
@@ -686,21 +686,21 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-std::vector<unsigned char> BaseDataStreamMarshaller::tightUnmarshalByteArray( 
-    io::DataInputStream* dataIn, 
-    utils::BooleanStream* bs ) 
+std::vector<unsigned char> BaseDataStreamMarshaller::tightUnmarshalByteArray(
+    io::DataInputStream* dataIn,
+    utils::BooleanStream* bs )
         throw ( io::IOException ) {
 
     try{
-        
+
         std::vector<unsigned char> data;
-                
+
         if( bs->readBoolean() ) {
             int size = dataIn->readInt();
             data.resize( size );
             dataIn->readFully( data );
         }
-        
+
         return data;
     }
     AMQ_CATCH_RETHROW( IOException )
@@ -709,16 +709,20 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-std::vector<unsigned char> BaseDataStreamMarshaller::looseUnmarshalByteArray( 
-    io::DataInputStream* dataIn ) 
-        throw ( io::IOException ) {  
+std::vector<unsigned char> BaseDataStreamMarshaller::looseUnmarshalByteArray(
+    io::DataInputStream* dataIn )
+        throw ( io::IOException ) {
 
     try{
-        int size = dataIn->readInt();
-        std::vector<unsigned char> data;
-        data.resize( size );
-        dataIn->readFully( data );
-        return data;
+        if( dataIn->readBoolean() ) {
+            int size = dataIn->readInt();
+            std::vector<unsigned char> data;
+            data.resize( size );
+            dataIn->readFully( data );
+            return data;
+        }
+
+        return std::vector<unsigned char>();
     }
     AMQ_CATCH_RETHROW( IOException )
     AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, IOException )
@@ -726,12 +730,12 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-std::vector<unsigned char> BaseDataStreamMarshaller::tightUnmarshalConstByteArray(

-    io::DataInputStream* dataIn, 
-    utils::BooleanStream* bs AMQCPP_UNUSED, 
-    int size ) 
+std::vector<unsigned char> BaseDataStreamMarshaller::tightUnmarshalConstByteArray(
+    io::DataInputStream* dataIn,
+    utils::BooleanStream* bs AMQCPP_UNUSED,
+    int size )
         throw ( io::IOException ) {
-         
+
     try{
         std::vector<unsigned char> data;
         data.resize( size );
@@ -744,10 +748,10 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-std::vector<unsigned char> BaseDataStreamMarshaller::looseUnmarshalConstByteArray(

-    io::DataInputStream* dataIn, 
-    int size ) 
-        throw ( io::IOException ) { 
+std::vector<unsigned char> BaseDataStreamMarshaller::looseUnmarshalConstByteArray(
+    io::DataInputStream* dataIn,
+    int size )
+        throw ( io::IOException ) {
 
     try{
         std::vector<unsigned char> data;
@@ -764,76 +768,76 @@
 std::string BaseDataStreamMarshaller::toString( const commands::MessageId* id )
 {
     if( id == NULL ) return "";
-    
-    return toString( id->getProducerId() ) + ":" + 
+
+    return toString( id->getProducerId() ) + ":" +
            Long::toString( id->getProducerSequenceId() );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 std::string BaseDataStreamMarshaller::toString( const commands::ProducerId* id )
 {
-    return id->getConnectionId() + ":" + 
-           Long::toString( id->getSessionId() ) + ":" + 
+    return id->getConnectionId() + ":" +
+           Long::toString( id->getSessionId() ) + ":" +
            Long::toString( id->getValue() );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 std::string BaseDataStreamMarshaller::toString( const commands::TransactionId* txnId )
 {
-    const LocalTransactionId* ltxnId = 
+    const LocalTransactionId* ltxnId =
         dynamic_cast<const LocalTransactionId*>( txnId );
-    const XATransactionId* xaTxnId = 
+    const XATransactionId* xaTxnId =
         dynamic_cast<const XATransactionId*>( txnId );
-        
+
     if( ltxnId != NULL )
     {
         return Long::toString( ltxnId->getValue() );
     }
     else if( xaTxnId != NULL )
     {
-        return string("XID:") + Integer::toString( xaTxnId->getFormatId() ) + ":" + 
-               toHexFromBytes( xaTxnId->getGlobalTransactionId() ) + ":" + 
-               toHexFromBytes( xaTxnId->getBranchQualifier() );        
+        return string("XID:") + Integer::toString( xaTxnId->getFormatId() ) + ":" +
+               toHexFromBytes( xaTxnId->getGlobalTransactionId() ) + ":" +
+               toHexFromBytes( xaTxnId->getBranchQualifier() );
     }
 
     return "";
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-std::string BaseDataStreamMarshaller::toHexFromBytes( 
+std::string BaseDataStreamMarshaller::toHexFromBytes(
     const std::vector<unsigned char>& data )
 {
     std::string buffer = "";
-    
+
     for( unsigned int i = 0; i < data.size(); i++ )
     {
         buffer.append( hexTable[ data[i] ] );
     }
-    
+
     return buffer;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-std::string BaseDataStreamMarshaller::readAsciiString( 
+std::string BaseDataStreamMarshaller::readAsciiString(
     io::DataInputStream* dataIn )
         throw ( io::IOException )
 {
     try{
-        
+
         int size = dataIn->readShort() + 1; // add space c++ NULL
-        unsigned char* data = new unsigned char[size];        
+        unsigned char* data = new unsigned char[size];
         dataIn->readFully( data, 0, size-1 );
         data[size-1] = 0;  // enforce NULL
-        
+
         // Now build a string and copy data into it.
         std::string text;
         text.resize( size );
         text.assign( (char*)data, (int)size-1 );
         delete [] data;
-        
-        return text; 
+
+        return text;
     }
     AMQ_CATCH_RETHROW( IOException )
     AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, IOException )
-    AMQ_CATCHALL_THROW( IOException )    
+    AMQ_CATCHALL_THROW( IOException )
 }



Mime
View raw message