activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r510332 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire: commands/ marshal/
Date Thu, 22 Feb 2007 00:48:03 GMT
Author: tabish
Date: Wed Feb 21 16:48:02 2007
New Revision: 510332

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

Added Exception Handlers

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMapMessage.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMapMessage.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMessageBase.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/BaseDataStructure.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/WireFormatInfo.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/MarshalAware.h

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMapMessage.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMapMessage.cpp?view=diff&rev=510332&r1=510331&r2=510332
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMapMessage.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMapMessage.cpp
Wed Feb 21 16:48:02 2007
@@ -42,30 +42,35 @@
 ////////////////////////////////////////////////////////////////////////////////
 unsigned char ActiveMQMapMessage::getDataStructureType() const
 {
-    return ActiveMQMapMessage::ID_ACTIVEMQMAPMESSAGE; 
+    return ActiveMQMapMessage::ID_ACTIVEMQMAPMESSAGE;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQMapMessage::beforeMarshal( OpenWireFormat* wireFormat AMQCPP_UNUSED ) {
+void ActiveMQMapMessage::beforeMarshal( OpenWireFormat* wireFormat )
+    throw ( io::IOException ) {
 
-    try{ 
-  
-        if( map != NULL && !map->isEmpty() ) {        
+    try{
+
+        // Let the base class do its thing.
+        ActiveMQMessageBase<cms::MapMessage>::beforeMarshal( wireFormat );
+
+        if( map != NULL && !map->isEmpty() ) {
             // Marshal as Content.
-            PrimitiveMapMarshaller::marshal( map, getContent() );        
+            PrimitiveMapMarshaller::marshal( map, getContent() );
         } else {
             clearBody();
         }
     }
-    AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
-    AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+    AMQ_CATCH_RETHROW( io::IOException )
+    AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, io::IOException )
+    AMQ_CATCHALL_THROW( io::IOException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 util::PrimitiveMap& ActiveMQMapMessage::getMap() throw ( NullPointerException ) {
 
-    try{ 
-        
+    try{
+
         this->checkMapIsUnmarshalled();
         return *map;
     }
@@ -74,7 +79,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const util::PrimitiveMap& ActiveMQMapMessage::getMap() const 
+const util::PrimitiveMap& ActiveMQMapMessage::getMap() const
     throw ( exceptions::NullPointerException ) {
 
     try{
@@ -87,26 +92,26 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQMapMessage::checkMapIsUnmarshalled() const 
+void ActiveMQMapMessage::checkMapIsUnmarshalled() const
     throw ( exceptions::NullPointerException ) {
 
     try {
 
         if( map == NULL ) {
-            
+
             if( getContent().size() == 0 ){
                 map = new PrimitiveMap;
             } else {
                 map = PrimitiveMapMarshaller::unmarshal( getContent() );
             }
-            
+
             if( map == NULL ) {
-                throw NullPointerException( 
+                throw NullPointerException(
                     __FILE__,
                     __LINE__,
-                    "ActiveMQMapMessage::getMap() - All attempts to create a " 
+                    "ActiveMQMapMessage::getMap() - All attempts to create a "
                     "map have fialed." );
-            }    
+            }
         }
     }
     AMQ_CATCH_RETHROW( exceptions::NullPointerException )
@@ -134,7 +139,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-bool ActiveMQMapMessage::getBoolean( const std::string& name ) const 
+bool ActiveMQMapMessage::getBoolean( const std::string& name ) const
     throw( cms::CMSException ) {
 
     try{
@@ -145,7 +150,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQMapMessage::setBoolean( const std::string& name, bool value ) 
+void ActiveMQMapMessage::setBoolean( const std::string& name, bool value )
     throw( cms::CMSException ) {
 
     try{
@@ -156,7 +161,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-unsigned char ActiveMQMapMessage::getByte( const std::string& name ) const 
+unsigned char ActiveMQMapMessage::getByte( const std::string& name ) const
     throw( cms::CMSException ) {
 
     try{
@@ -168,7 +173,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 void ActiveMQMapMessage::setByte( const std::string& name,
-                                  unsigned char value ) 
+                                  unsigned char value )
                                       throw( cms::CMSException ) {
 
     try{
@@ -179,7 +184,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-std::vector<unsigned char> ActiveMQMapMessage::getBytes( const std::string& name
) const 
+std::vector<unsigned char> ActiveMQMapMessage::getBytes( const std::string& name
) const
     throw( cms::CMSException ) {
 
     try{
@@ -191,7 +196,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 void ActiveMQMapMessage::setBytes( const std::string& name,
-                                   const std::vector<unsigned char>& value ) 
+                                   const std::vector<unsigned char>& value )
                                        throw( cms::CMSException ) {
 
     try{
@@ -202,7 +207,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-char ActiveMQMapMessage::getChar( const std::string& name ) const 
+char ActiveMQMapMessage::getChar( const std::string& name ) const
     throw( cms::CMSException ) {
 
     try{
@@ -213,7 +218,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQMapMessage::setChar( const std::string& name, char value ) 
+void ActiveMQMapMessage::setChar( const std::string& name, char value )
     throw( cms::CMSException ) {
 
     try{
@@ -224,7 +229,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-double ActiveMQMapMessage::getDouble( const std::string& name ) const 
+double ActiveMQMapMessage::getDouble( const std::string& name ) const
     throw( cms::CMSException ) {
 
     try{
@@ -236,7 +241,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 void ActiveMQMapMessage::setDouble( const std::string& name,
-                                    double value ) 
+                                    double value )
                                         throw( cms::CMSException ) {
 
     try{
@@ -247,7 +252,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-float ActiveMQMapMessage::getFloat( const std::string& name ) const 
+float ActiveMQMapMessage::getFloat( const std::string& name ) const
     throw( cms::CMSException ) {
 
     try{
@@ -258,7 +263,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQMapMessage::setFloat( const std::string& name, float value ) 
+void ActiveMQMapMessage::setFloat( const std::string& name, float value )
     throw( cms::CMSException ) {
 
     try{
@@ -269,7 +274,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-int ActiveMQMapMessage::getInt( const std::string& name ) const 
+int ActiveMQMapMessage::getInt( const std::string& name ) const
     throw( cms::CMSException ) {
 
     try{
@@ -280,7 +285,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQMapMessage::setInt( const std::string& name, int value ) 
+void ActiveMQMapMessage::setInt( const std::string& name, int value )
     throw( cms::CMSException ) {
 
     try{
@@ -291,7 +296,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-long long ActiveMQMapMessage::getLong( const std::string& name ) const 
+long long ActiveMQMapMessage::getLong( const std::string& name ) const
     throw( cms::CMSException ) {
 
     try{
@@ -302,7 +307,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQMapMessage::setLong( const std::string& name, long long value ) 
+void ActiveMQMapMessage::setLong( const std::string& name, long long value )
     throw( cms::CMSException ) {
 
     try{
@@ -313,7 +318,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-short ActiveMQMapMessage::getShort( const std::string& name ) const 
+short ActiveMQMapMessage::getShort( const std::string& name ) const
     throw( cms::CMSException ) {
 
     try{
@@ -324,7 +329,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQMapMessage::setShort( const std::string& name, short value ) 
+void ActiveMQMapMessage::setShort( const std::string& name, short value )
     throw( cms::CMSException ) {
 
     try{
@@ -335,7 +340,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-std::string ActiveMQMapMessage::getString( const std::string& name ) const 
+std::string ActiveMQMapMessage::getString( const std::string& name ) const
     throw( cms::CMSException ) {
 
     try{
@@ -346,8 +351,8 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQMapMessage::setString( const std::string& name, 
-                                    const std::string& value ) 
+void ActiveMQMapMessage::setString( const std::string& name,
+                                    const std::string& value )
                                         throw( cms::CMSException ) {
 
     try{

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMapMessage.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMapMessage.h?view=diff&rev=510332&r1=510331&r2=510332
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMapMessage.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMapMessage.h
Wed Feb 21 16:48:02 2007
@@ -82,7 +82,8 @@
          * Perform any processing needed before an marshal
          * @param wireformat - the OpenWireFormat object in use.
          */
-        virtual void beforeMarshal( OpenWireFormat* wireFormat AMQCPP_UNUSED );
+        virtual void beforeMarshal( OpenWireFormat* wireFormat )
+            throw ( io::IOException );
 
         /**
          * Returns a string containing the information for this DataStructure

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMessageBase.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMessageBase.h?view=diff&rev=510332&r1=510331&r2=510332
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMessageBase.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMessageBase.h
Wed Feb 21 16:48:02 2007
@@ -75,7 +75,9 @@
          * wire
          * @param wireFormat - the wireformatting controller
          */
-        virtual void beforeMarshal( OpenWireFormat* wireFormat AMQCPP_UNUSED ) {
+        virtual void beforeMarshal( OpenWireFormat* wireFormat AMQCPP_UNUSED )
+            throw ( io::IOException ) {
+
             try{
 
                 marshalledProperties.clear();
@@ -85,8 +87,9 @@
                         &properties, marshalledProperties );
                 }
             }
-            AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
-            AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+            AMQ_CATCH_RETHROW( io::IOException )
+            AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, io::IOException )
+            AMQ_CATCHALL_THROW( io::IOException )
         }
 
         /**
@@ -94,14 +97,17 @@
          * unmarshaled.
          * @param wireFormat - the wireformat object to control unmarshaling
          */
-        virtual void afterUnmarshal( OpenWireFormat* wireFormat AMQCPP_UNUSED ) {
+        virtual void afterUnmarshal( OpenWireFormat* wireFormat AMQCPP_UNUSED )
+            throw ( io::IOException ) {
+
             try{
 
                 marshal::PrimitiveMapMarshaller::unmarshal(
                     &properties, marshalledProperties );
             }
-            AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
-            AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+            AMQ_CATCH_RETHROW( io::IOException )
+            AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, io::IOException )
+            AMQ_CATCHALL_THROW( io::IOException )
         }
 
         /**

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/BaseDataStructure.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/BaseDataStructure.h?view=diff&rev=510332&r1=510331&r2=510332
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/BaseDataStructure.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/BaseDataStructure.h
Wed Feb 21 16:48:02 2007
@@ -52,25 +52,29 @@
          * Perform any processing needed before an marshal
          * @param wireformat - the OpenWireFormat object in use.
          */
-        virtual void beforeMarshal( OpenWireFormat* wireFormat AMQCPP_UNUSED) {}
+        virtual void beforeMarshal( OpenWireFormat* wireFormat AMQCPP_UNUSED)
+            throw ( io::IOException ) {}
 
         /**
          * Perform any processing needed after an unmarshal
          * @param wireformat - the OpenWireFormat object in use.
          */
-        virtual void afterMarshal( OpenWireFormat* wireFormat AMQCPP_UNUSED) {}
+        virtual void afterMarshal( OpenWireFormat* wireFormat AMQCPP_UNUSED)
+            throw ( io::IOException ) {}
 
         /**
          * Perform any processing needed before an unmarshal
          * @param wireformat - the OpenWireFormat object in use.
          */
-        virtual void beforeUnmarshal( OpenWireFormat* wireFormat AMQCPP_UNUSED) {}
+        virtual void beforeUnmarshal( OpenWireFormat* wireFormat AMQCPP_UNUSED)
+            throw ( io::IOException ) {}
 
         /**
          * Perform any processing needed after an unmarshal
          * @param wireformat - the OpenWireFormat object in use.
          */
-        virtual void afterUnmarshal( OpenWireFormat* wireFormat AMQCPP_UNUSED) {}
+        virtual void afterUnmarshal( OpenWireFormat* wireFormat AMQCPP_UNUSED)
+            throw ( io::IOException ) {}
 
         /**
          * Called to set the data to this object that will contain the objects

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/WireFormatInfo.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/WireFormatInfo.h?view=diff&rev=510332&r1=510331&r2=510332
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/WireFormatInfo.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/WireFormatInfo.h
Wed Feb 21 16:48:02 2007
@@ -228,7 +228,9 @@
          * wire
          * @param wireFormat - the wireformatting controller
          */
-        virtual void beforeMarshal( OpenWireFormat* wireFormat AMQCPP_UNUSED ) {
+        virtual void beforeMarshal( OpenWireFormat* wireFormat AMQCPP_UNUSED )
+            throw ( io::IOException ) {
+
             try{
 
                 marshalledProperties.clear();
@@ -238,8 +240,9 @@
                         &properties, marshalledProperties );
                 }
             }
-            AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
-            AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+            AMQ_CATCH_RETHROW( io::IOException )
+            AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, io::IOException )
+            AMQ_CATCHALL_THROW( io::IOException )
         }
 
         /**
@@ -247,14 +250,17 @@
          * unmarshaled.
          * @param wireFormat - the wireformat object to control unmarshaling
          */
-        virtual void afterUnmarshal( OpenWireFormat* wireFormat AMQCPP_UNUSED ) {
+        virtual void afterUnmarshal( OpenWireFormat* wireFormat AMQCPP_UNUSED )
+            throw ( io::IOException ) {
+
             try{
 
                 marshal::PrimitiveMapMarshaller::unmarshal(
                     &properties, marshalledProperties );
             }
-            AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
-            AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+            AMQ_CATCH_RETHROW( io::IOException )
+            AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, io::IOException )
+            AMQ_CATCHALL_THROW( io::IOException )
         }
 
     private:

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/MarshalAware.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/MarshalAware.h?view=diff&rev=510332&r1=510331&r2=510332
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/MarshalAware.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/MarshalAware.h
Wed Feb 21 16:48:02 2007
@@ -18,7 +18,8 @@
 #ifndef _ACTIVEMQ_CONNECTOR_OPENWIRE_MARSHAL_MARSHALAWARE_H_
 #define _ACTIVEMQ_CONNECTOR_OPENWIRE_MARSHAL_MARSHALAWARE_H_
 
-#include <vector> 
+#include <vector>
+#include <activemq/io/IOException.h>
 
 namespace activemq{
 namespace connector{
@@ -32,62 +33,66 @@
     class MarshalAware
     {
     public:
-    
+
         virtual ~MarshalAware() {}
-        
+
         /**
          * Determine if the class implementing this interface is really
-         * wanting to be told about marshaling.  Normally if you didn't 
+         * wanting to be told about marshaling.  Normally if you didn't
          * want to be marshal aware you just wouldn't implement this interface
          * but since this is C++ and we don't have true interfaces we need
          * a flat inheritance heirarchy, so we always implement this.
          * @returns true if this class cares about marshaling.
          */
         virtual bool isMarshalAware() const = 0;
-        
+
         /**
          * Called before marshaling is started to prepare the object to be
          * marshaled.
          * @param wireFormat - the wireformat object to control marshaling
          */
-        virtual void beforeMarshal( OpenWireFormat* wireFormat ) = 0;
+        virtual void beforeMarshal( OpenWireFormat* wireFormat )
+            throw ( io::IOException ) = 0;
 
         /**
          * Called after marshaling is started to cleanup the object being
          * marshaled.
          * @param wireFormat - the wireformat object to control marshaling
          */
-        virtual void afterMarshal( OpenWireFormat* wireFormat ) = 0;
-        
+        virtual void afterMarshal( OpenWireFormat* wireFormat )
+            throw ( io::IOException ) = 0;
+
         /**
          * Called before unmarshaling is started to prepare the object to be
          * unmarshaled.
          * @param wireFormat - the wireformat object to control unmarshaling
          */
-        virtual void beforeUnmarshal( OpenWireFormat* wireFormat ) = 0;
+        virtual void beforeUnmarshal( OpenWireFormat* wireFormat )
+            throw ( io::IOException ) = 0;
 
         /**
          * Called after unmarshaling is started to cleanup the object being
          * unmarshaled.
          * @param wireFormat - the wireformat object to control unmarshaling
          */
-        virtual void afterUnmarshal( OpenWireFormat* wireFormat ) = 0;
-        
+        virtual void afterUnmarshal( OpenWireFormat* wireFormat )
+            throw ( io::IOException ) = 0;
+
         /**
          * Called to set the data to this object that will contain the objects
          * marshaled form.
          * @param wireFormat - the wireformat object to control unmarshaling
          * @param data - vector of object binary data
-         */ 
-        virtual void setMarshaledForm( OpenWireFormat* wireFormat, 
-                                        const std::vector<char>& data ) = 0;
+         */
+        virtual void setMarshaledForm( OpenWireFormat* wireFormat,
+                                       const std::vector<char>& data ) = 0;
 
         /**
          * Called to get the data to this object that will contain the objects
          * marshaled form.
          * @param wireFormat - the wireformat object to control unmarshaling
          * @return buffer that holds the objects data.
-         */ 
+         */
         virtual std::vector<unsigned char> getMarshaledForm( OpenWireFormat* wireFormat
) = 0;
 
     };



Mime
View raw message