activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r762007 [2/2] - in /activemq/activemq-cpp/trunk/activemq-cpp/src: main/ main/activemq/cmsutil/ main/activemq/commands/ main/activemq/core/ main/activemq/exceptions/ main/activemq/wireformat/stomp/marshal/ main/cms/ main/decaf/util/concurren...
Date Sat, 04 Apr 2009 21:01:33 GMT
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/CMSException.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/CMSException.h?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/CMSException.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/CMSException.h Sat Apr  4 21:01:32
2009
@@ -15,37 +15,69 @@
  * limitations under the License.
  */
 
-#ifndef CMS_CMSEXCEPTION_H
-#define CMS_CMSEXCEPTION_H
+#ifndef _CMS_CMSEXCEPTION_H_
+#define _CMS_CMSEXCEPTION_H_
 
 // Includes
 #include <string>
 #include <vector>
 #include <iostream>
 #include <exception>
+#include <memory>
 
 #include <cms/Config.h>
 
 namespace cms{
 
     /**
-     * This class represents an error that has occurred in
-     * cms.
+     * This class represents an error that has occurred in cms, providers
+     * can wrap provider specific exceptions in this class by setting the
+     * cause to an instance of a provider specific exception provided it
+     * can be cast to an std::exception.
+     *
+     * @since 1.0
      */
-    class CMS_API CMSException : public virtual std::exception {
+    class CMS_API CMSException : public std::exception {
+    private:
+
+        /**
+         * The cause of this exception.
+         */
+        std::string message;
+
+        /**
+         * The Exception that caused this one to be thrown.
+         */
+        mutable std::auto_ptr<const std::exception> cause;
+
+        /**
+         * The stack trace.
+         */
+        std::vector< std::pair< std::string, int> > stackTrace;
 
     public:
 
-        CMSException() throw() {}
+        CMSException() throw();
+
+        CMSException( const CMSException& ex ) throw();
 
-        virtual ~CMSException() throw() {}
+        CMSException( const std::string& message,
+                      const std::exception* cause ) throw();
+
+        CMSException( const std::string& message,
+                      const std::exception* cause,
+                      const std::vector< std::pair< std::string, int> >&
stackTrace ) throw();
+
+        virtual ~CMSException() throw();
 
         /**
          * Gets the cause of the error.
          *
          * @return string errors message
          */
-        virtual std::string getMessage() const = 0;
+        virtual std::string getMessage() const {
+            return this->message;
+        }
 
         /**
          * Gets the exception that caused this one to be thrown, this allows
@@ -56,26 +88,9 @@
          * @returns a const pointer reference to the causal exception, if there
          * was no cause associated with this exception then NULL is returned.
          */
-        virtual const std::exception* getCause() const = 0;
-
-        /**
-         * Adds a file/line number to the stack trace.
-         *
-         * @param file
-         *      The name of the file calling this method (use __FILE__).
-         * @param lineNumber
-         *      The line number in the calling file (use __LINE__).
-         */
-        virtual void setMark( const char* file, const int lineNumber ) = 0;
-
-        /**
-         * Clones this exception.  This is useful for cases where you need
-         * to preserve the type of the original exception as well as the message.
-         * All subclasses should override.
-         *
-         * @return Copy of this Exception object
-         */
-        virtual CMSException* clone() const = 0;
+        virtual const std::exception* getCause() const {
+            return this->cause.get();
+        }
 
         /**
          * Provides the stack trace for every point where
@@ -83,29 +98,38 @@
          *
          * @return vector containing stack trace strings
          */
-        virtual std::vector< std::pair< std::string, int> > getStackTrace() const
= 0;
+        virtual std::vector< std::pair< std::string, int> > getStackTrace() const
{
+            return this->stackTrace;
+        }
+
+        /**
+         * Adds a file/line number to the stack trace.
+         * @param file The name of the file calling this method (use __FILE__).
+         * @param lineNumber The line number in the calling file (use __LINE__).
+         */
+        virtual void setMark( const char* file, const int lineNumber );
 
         /**
          * Prints the stack trace to std::err
          */
-        virtual void printStackTrace() const = 0;
+        virtual void printStackTrace() const;
 
         /**
          * Prints the stack trace to the given output stream.
          *
          * @param stream the target output stream.
          */
-        virtual void printStackTrace( std::ostream& stream ) const = 0;
+        virtual void printStackTrace( std::ostream& stream ) const;
 
         /**
          * Gets the stack trace as one contiguous string.
          *
          * @return string with formatted stack trace data
          */
-        virtual std::string getStackTraceString() const = 0;
+        virtual std::string getStackTraceString() const;
 
     };
 
 }
 
-#endif /*CMS_CMSEXCEPTION_H*/
+#endif /*_CMS_CMSEXCEPTION_H_*/

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/PooledThread.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/PooledThread.cpp?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/PooledThread.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/PooledThread.cpp
Sat Apr  4 21:01:32 2009
@@ -54,7 +54,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void PooledThread::run(void)
+void PooledThread::run()
 {
     ThreadPool::Task task;
 
@@ -158,7 +158,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void PooledThread::stop(void) throw ( Exception )
+void PooledThread::stop() throw ( Exception )
 {
     done = true;
 }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/LogWriter.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/LogWriter.h?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/LogWriter.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/LogWriter.h Sat Apr
 4 21:01:32 2009
@@ -26,8 +26,8 @@
     class DECAF_API LogWriter {
     public:
 
-        LogWriter(void);
-        virtual ~LogWriter(void);
+        LogWriter();
+        virtual ~LogWriter();
 
         /**
          * Writes a message to the output destination

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/Logger.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/Logger.h?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/Logger.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/Logger.h Sat Apr
 4 21:01:32 2009
@@ -77,7 +77,7 @@
          * Gets the name of this Logger
          * @return logger name
          */
-        virtual const std::string& getName(void) const {
+        virtual const std::string& getName() const {
             return name;
         }
 
@@ -107,7 +107,7 @@
          * has been assigned to use.
          * @returns a list of handlers that are used by this logger
          */
-        // virtual const std::list<Handler*>& getHandlers(void) const;
+        // virtual const std::list<Handler*>& getHandlers() const;
 
         /**
          * Set a filter to control output on this Logger.

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/MarkBlockLogger.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/MarkBlockLogger.h?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/MarkBlockLogger.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/MarkBlockLogger.h
Sat Apr  4 21:01:32 2009
@@ -57,7 +57,7 @@
             logger.mark(blockName + " - Entered");
         }
 
-        virtual ~MarkBlockLogger(void)
+        virtual ~MarkBlockLogger()
         {
             logger->mark(blockName + " - Exited");
         }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/CmsTemplateTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/CmsTemplateTest.cpp?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/CmsTemplateTest.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/CmsTemplateTest.cpp
Sat Apr  4 21:01:32 2009
@@ -198,7 +198,7 @@
         try {
             cmsTemplate.receive();
             CPPUNIT_FAIL("failed to throw expected exception");
-        } catch( ActiveMQException& ex ) {
+        } catch( CMSException& ex ) {
             // Expected.
         }
 
@@ -218,7 +218,7 @@
         CPPUNIT_ASSERT( message != NULL );
         delete message;
 
-    } catch ( ActiveMQException e ) {
+    } catch ( CMSException& e ) {
         e.printStackTrace();
         CPPUNIT_ASSERT( false );
     }
@@ -237,7 +237,7 @@
             TextMessageCreator msgCreator( "hello world" );
             cmsTemplate.send( &msgCreator );
             CPPUNIT_FAIL( "failed to throw expected exception" );
-        } catch( ActiveMQException& ex ) {
+        } catch( CMSException& ex ) {
             // Expected.
         }
 
@@ -248,7 +248,7 @@
         TextMessageCreator msgCreator( "hello world" );
         cmsTemplate.send( &msgCreator );
 
-    } catch ( ActiveMQException e ) {
+    } catch ( CMSException& e ) {
         e.printStackTrace();
         throw e;
     }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleTest.cpp?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleTest.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleTest.cpp
Sat Apr  4 21:01:32 2009
@@ -373,14 +373,14 @@
         CPPUNIT_ASSERT_THROW_MESSAGE(
             "Should throw an ActiveMQExceptio",
             message->setStringProperty( "FOO", "BAR" ),
-            exceptions::ActiveMQException );
+            cms::CMSException );
 
         BytesMessage* bytesMessage2 = dynamic_cast<cms::BytesMessage*>( message.get()
);
         CPPUNIT_ASSERT( bytesMessage2 != NULL );
         CPPUNIT_ASSERT_THROW_MESSAGE(
             "Should throw an ActiveMQExceptio",
             bytesMessage2->writeBoolean( false ),
-            exceptions::ActiveMQException );
+            cms::CMSException );
 
         CPPUNIT_ASSERT( bytesMessage2->readBoolean() == true );
         CPPUNIT_ASSERT( bytesMessage2->readByte() == 127 );

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/cmsutil/CmsTemplateTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/cmsutil/CmsTemplateTest.h?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/cmsutil/CmsTemplateTest.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/cmsutil/CmsTemplateTest.h Sat
Apr  4 21:01:32 2009
@@ -32,7 +32,7 @@
 namespace cmsutil{
 
     class DummyConnectionFactory;
-    
+
     class CmsTemplateTest : public CppUnit::TestFixture
     {
         CPPUNIT_TEST_SUITE( CmsTemplateTest );
@@ -44,16 +44,16 @@
         CPPUNIT_TEST( testReceive_DestinationName );
         CPPUNIT_TEST( testReceiveSelected );
         CPPUNIT_TEST( testReceiveSelected_Destination );
-        CPPUNIT_TEST( testReceiveSelected_DestinationName );        
-        CPPUNIT_TEST_SUITE_END();               
-             
+        CPPUNIT_TEST( testReceiveSelected_DestinationName );
+        CPPUNIT_TEST_SUITE_END();
+
 
         CmsTemplate* cmsTemplate;
         DummyConnectionFactory* cf;
-        
+
         class MySendListener : public MessageContext::SendListener {
         public:
-            
+
             const cms::Destination* dest;
             cms::Message* message;
             int deliveryMode;
@@ -62,7 +62,7 @@
             std::string selector;
             bool noLocal;
             long long timeout;
-                    
+
             MySendListener() {
                 dest = NULL;
                 message = NULL;
@@ -71,9 +71,9 @@
                 ttl = 0LL;
             }
             virtual ~MySendListener(){}
-            
+
             virtual void onSend(const cms::Destination* destination,
-                cms::Message* message, int deliveryMode, int priority, 
+                cms::Message* message, int deliveryMode, int priority,
                 long long timeToLive) throw (cms::CMSException){
                 this->dest = destination;
                 this->message = message;
@@ -81,10 +81,10 @@
                 this->priority = priority;
                 this->ttl = timeToLive;
             }
-            
-            virtual cms::Message* doReceive(const cms::Destination* dest, 
-                    const std::string& selector, 
-                    bool noLocal, 
+
+            virtual cms::Message* doReceive(const cms::Destination* dest,
+                    const std::string& selector,
+                    bool noLocal,
                     long long timeout) throw (cms::CMSException){
                 this->dest = dest;
                 this->selector = selector;
@@ -93,64 +93,64 @@
                 return new DummyMessage();
             }
         };
-        
+
         class FailSendListener : public MessageContext::SendListener {
         public:
-                    
+
             FailSendListener() {
             }
             virtual ~FailSendListener(){}
-            
+
             virtual void onSend(const cms::Destination* destination,
-                    cms::Message* message, int deliveryMode, int priority, 
+                    cms::Message* message, int deliveryMode, int priority,
                     long long timeToLive) throw (cms::CMSException){
-                throw exceptions::ActiveMQException(__FILE__, __LINE__, "");
+                throw cms::CMSException();
             }
-            
-            virtual cms::Message* doReceive(const cms::Destination* dest, 
-                    const std::string& selector, 
-                    bool noLocal, 
+
+            virtual cms::Message* doReceive(const cms::Destination* dest,
+                    const std::string& selector,
+                    bool noLocal,
                     long long timeout) throw (cms::CMSException){
-                throw exceptions::ActiveMQException(__FILE__, __LINE__, "");
+                throw cms::CMSException();
             }
         };
-        
+
         class MySessionCallback : public SessionCallback {
         public:
-            
+
             cms::Session* session;
             cms::Session::AcknowledgeMode ackMode;
-            
+
             MySessionCallback() {
                 session = NULL;
             }
             virtual ~MySessionCallback(){}
-            
-            virtual void doInCms(cms::Session* session) throw (cms::CMSException) {     
      
+
+            virtual void doInCms(cms::Session* session) throw (cms::CMSException) {
                 this->session = session;
                 this->ackMode = session->getAcknowledgeMode();
             }
         };
-        
+
         class MyProducerCallback : public ProducerCallback {
         public:
-            
+
             cms::Session* session;
             cms::MessageProducer* producer;
-            
+
             MyProducerCallback() {
                 session = NULL;
                 producer = NULL;
             }
             virtual ~MyProducerCallback(){}
-            
-            virtual void doInCms(cms::Session* session, 
+
+            virtual void doInCms(cms::Session* session,
                     cms::MessageProducer* producer) throw (cms::CMSException) {
                 this->session = session;
                 this->producer = producer;
             }
         };
-        
+
     public:
 
         CmsTemplateTest() {}
@@ -158,7 +158,7 @@
 
         virtual void setUp();
         virtual void tearDown();
-        
+
         void testExecuteSession();
         void testExecuteProducer();
         void testSend();

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.h?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.h
Sat Apr  4 21:01:32 2009
@@ -125,8 +125,8 @@
 
     public:
 
-        ActiveMQSessionTest(void) {}
-        virtual ~ActiveMQSessionTest(void) {}
+        ActiveMQSessionTest() {}
+        virtual ~ActiveMQSessionTest() {}
 
         void testAutoAcking();
         void testClientAck();

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/lang/BooleanTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/lang/BooleanTest.cpp?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/lang/BooleanTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/lang/BooleanTest.cpp Sat Apr 
4 21:01:32 2009
@@ -21,7 +21,7 @@
 using namespace decaf;
 using namespace decaf::lang;
 
-void BooleanTest::test(void)
+void BooleanTest::test()
 {
     bool x = Boolean::parseBoolean("false");
     bool y = Boolean::parseBoolean("true");

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/lang/BooleanTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/lang/BooleanTest.h?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/lang/BooleanTest.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/lang/BooleanTest.h Sat Apr  4
21:01:32 2009
@@ -37,7 +37,7 @@
         BooleanTest() {}
         virtual ~BooleanTest() {}
 
-        virtual void test(void);
+        virtual void test();
 
     };
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/lang/IntegerTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/lang/IntegerTest.cpp?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/lang/IntegerTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/lang/IntegerTest.cpp Sat Apr 
4 21:01:32 2009
@@ -22,7 +22,7 @@
 using namespace decaf::lang;
 
 ////////////////////////////////////////////////////////////////////////////////
-void IntegerTest::test(void)
+void IntegerTest::test()
 {
     int x = Integer::parseInt("12");
     int y = Integer::parseInt("FF", 16);

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/lang/IntegerTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/lang/IntegerTest.h?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/lang/IntegerTest.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/lang/IntegerTest.h Sat Apr  4
21:01:32 2009
@@ -35,8 +35,8 @@
 
     public:
 
-        IntegerTest(void) {}
-        virtual ~IntegerTest(void) {}
+        IntegerTest() {}
+        virtual ~IntegerTest() {}
 
         virtual void test();
         virtual void test2();

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/concurrent/ThreadPoolTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/concurrent/ThreadPoolTest.h?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/concurrent/ThreadPoolTest.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/concurrent/ThreadPoolTest.h
Sat Apr  4 21:01:32 2009
@@ -92,7 +92,7 @@
 
             virtual ~MyTask() {};
 
-            virtual void run(void) {
+            virtual void run() {
                 value += 100;
             }
         };
@@ -111,7 +111,7 @@
 
             virtual ~MyWaitingTask() {};
 
-            virtual void run(void) {
+            virtual void run() {
                 try
                 {
                     synchronized(mutex) {



Mime
View raw message