activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r593729 - in /activemq/activemq-cpp/trunk/src/main/activemq/core: ActiveMQProducer.cpp ActiveMQSession.cpp
Date Sat, 10 Nov 2007 03:30:44 GMT
Author: tabish
Date: Fri Nov  9 19:30:44 2007
New Revision: 593729

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

Modified:
    activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQProducer.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.cpp

Modified: activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQProducer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQProducer.cpp?rev=593729&r1=593728&r2=593729&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQProducer.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQProducer.cpp Fri Nov  9 19:30:44
2007
@@ -33,11 +33,10 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 ActiveMQProducer::ActiveMQProducer( connector::ProducerInfo* producerInfo,
-                                    ActiveMQSession* session )
-{
-    if( session == NULL || producerInfo == NULL )
-    {
-        throw NullPointerException(
+                                    ActiveMQSession* session ) {
+
+    if( session == NULL || producerInfo == NULL ) {
+        throw ActiveMQException(
             __FILE__, __LINE__,
             "ActiveMQProducer::ActiveMQProducer - Init with NULL Session" );
     }
@@ -58,12 +57,9 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ActiveMQProducer::~ActiveMQProducer(void)
-{
-    try
-    {
+ActiveMQProducer::~ActiveMQProducer() {
+    try {
         close();
-
         delete producerInfo;
     }
     AMQ_CATCH_NOTHROW( ActiveMQException )
@@ -71,11 +67,10 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQProducer::close()
-    throw ( cms::CMSException )
-{
-    try
-    {
+void ActiveMQProducer::close() throw ( cms::CMSException ) {
+
+    try{
+
         if( !closed ) {
 
             // Close the ProducerInfo
@@ -89,18 +84,18 @@
         }
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void ActiveMQProducer::send( cms::Message* message )
-    throw ( cms::CMSException )
-{
-    try
-    {
-        if( closed )
-        {
-            throw InvalidStateException(
+    throw ( cms::CMSException ) {
+
+    try {
+
+        if( closed ) {
+            throw ActiveMQException(
                 __FILE__, __LINE__,
                 "ActiveMQProducer::send - This Producer is closed" );
         }
@@ -108,19 +103,18 @@
         send( producerInfo->getDestination(), message );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void ActiveMQProducer::send( cms::Message* message, int deliveryMode,
                              int priority, long long timeToLive )
-                                throw ( cms::CMSException )
-{
-    try
-    {
-        if( closed )
-        {
-            throw InvalidStateException(
+                                throw ( cms::CMSException ) {
+    try {
+
+        if( closed ) {
+            throw ActiveMQException(
                 __FILE__, __LINE__,
                 "ActiveMQProducer::send - This Producer is closed" );
         }
@@ -129,18 +123,18 @@
               priority, timeToLive );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void ActiveMQProducer::send( const cms::Destination* destination,
-                             cms::Message* message ) throw ( cms::CMSException )
-{
-    try
-    {
-        if( closed )
-        {
-            throw InvalidStateException(
+                             cms::Message* message ) throw ( cms::CMSException ) {
+
+    try {
+
+        if( closed ) {
+            throw ActiveMQException(
                 __FILE__, __LINE__,
                 "ActiveMQProducer::send - This Producer is closed" );
         }
@@ -149,6 +143,7 @@
               defaultPriority, defaultTimeToLive );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
@@ -156,20 +151,19 @@
 void ActiveMQProducer::send( const cms::Destination* destination,
                              cms::Message* message, int deliveryMode,
                              int priority, long long timeToLive )
-    throw ( cms::CMSException )
-{
-    try
-    {
-        if( closed )
-        {
-            throw InvalidStateException(
+    throw ( cms::CMSException ) {
+
+    try {
+
+        if( closed ) {
+            throw ActiveMQException(
                 __FILE__, __LINE__,
                 "ActiveMQProducer::send - This Producer is closed" );
         }
 
         if( destination == NULL ) {
 
-            throw InvalidStateException(
+            throw ActiveMQException(
                 __FILE__, __LINE__,
                 "ActiveMQProducer::send - Attempting to send on NULL destination");
         }
@@ -194,6 +188,7 @@
         session->send( message, this );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
@@ -203,16 +198,15 @@
 
     try{
 
-        if( closed )
-        {
-            throw InvalidStateException(
+        if( closed ) {
+            throw ActiveMQException(
                 __FILE__, __LINE__,
                 "ActiveMQProducer::onConnectorResourceClosed - "
                 "Producer Already Closed");
         }
 
         if( resource != producerInfo ) {
-            throw IllegalArgumentException(
+            throw ActiveMQException(
                 __FILE__, __LINE__,
                 "ActiveMQProducer::onConnectorResourceClosed - "
                 "Unknown object passed to this callback");
@@ -222,5 +216,6 @@
         this->close();
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
 }

Modified: activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.cpp?rev=593729&r1=593728&r2=593729&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.cpp Fri Nov  9 19:30:44
2007
@@ -38,16 +38,16 @@
 using namespace activemq::connector;
 using namespace activemq::exceptions;
 using namespace decaf::util;
+using namespace decaf::lang;
 using namespace decaf::lang::exceptions;
 
 ////////////////////////////////////////////////////////////////////////////////
 ActiveMQSession::ActiveMQSession( SessionInfo* sessionInfo,
                                   const Properties& properties,
-                                  ActiveMQConnection* connection )
-{
-    if( sessionInfo == NULL || connection == NULL )
-    {
-        throw NullPointerException(
+                                  ActiveMQConnection* connection ) {
+
+    if( sessionInfo == NULL || connection == NULL ) {
+        throw ActiveMQException(
             __FILE__, __LINE__,
             "ActiveMQSession::ActiveMQSession - Init with NULL data");
     }
@@ -58,8 +58,7 @@
     this->closed = false;
 
     // Create a Transaction object only if the session is transactional
-    if( isTransacted() )
-    {
+    if( isTransacted() ) {
         transaction =
             new ActiveMQTransaction(connection, this, properties );
     }
@@ -69,10 +68,8 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ActiveMQSession::~ActiveMQSession()
-{
-    try
-    {
+ActiveMQSession::~ActiveMQSession() {
+    try{
         // Destroy this session's resources
         close();
     }
@@ -95,8 +92,8 @@
         return;
     }
 
-    try
-    {
+    try {
+
         // Stop the dispatch executor.
         stop();
 
@@ -134,17 +131,17 @@
         executor = NULL;
     }
     AMQ_CATCH_NOTHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
     AMQ_CATCHALL_NOTHROW( )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQSession::commit() throw ( cms::CMSException )
-{
-    try
-    {
-        if( closed || !isTransacted() )
-        {
-            throw InvalidStateException(
+void ActiveMQSession::commit() throw ( cms::CMSException ) {
+
+    try {
+
+        if( closed || !isTransacted() ) {
+            throw ActiveMQException(
                 __FILE__, __LINE__,
                 "ActiveMQSession::commit - This Session Can't Commit");
         }
@@ -153,17 +150,17 @@
         transaction->commit();
     }
     AMQ_CATCH_NOTHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
     AMQ_CATCHALL_NOTHROW( )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQSession::rollback() throw ( cms::CMSException )
-{
-    try
-    {
-        if( closed || !isTransacted() )
-        {
-            throw InvalidStateException(
+void ActiveMQSession::rollback() throw ( cms::CMSException ) {
+
+    try{
+
+        if( closed || !isTransacted() ) {
+            throw ActiveMQException(
                 __FILE__, __LINE__,
                 "ActiveMQSession::rollback - This Session Can't Rollback" );
         }
@@ -172,19 +169,19 @@
         transaction->rollback();
     }
     AMQ_CATCH_NOTHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
     AMQ_CATCHALL_NOTHROW( )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 cms::MessageConsumer* ActiveMQSession::createConsumer(
     const cms::Destination* destination )
-        throw ( cms::CMSException )
-{
-    try
-    {
-        if( closed )
-        {
-            throw InvalidStateException(
+        throw ( cms::CMSException ) {
+
+    try{
+
+        if( closed ) {
+            throw ActiveMQException(
                 __FILE__, __LINE__,
                 "ActiveMQSession::createConsumer - Session Already Closed" );
         }
@@ -192,6 +189,7 @@
         return createConsumer( destination, "", false );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
@@ -199,13 +197,11 @@
 cms::MessageConsumer* ActiveMQSession::createConsumer(
     const cms::Destination* destination,
     const std::string& selector )
-        throw ( cms::CMSException )
-{
-    try
-    {
-        if( closed )
-        {
-            throw InvalidStateException(
+        throw ( cms::CMSException ) {
+
+    try{
+        if( closed ) {
+            throw ActiveMQException(
                 __FILE__, __LINE__,
                 "ActiveMQSession::createConsumer - Session Already Closed" );
         }
@@ -213,6 +209,7 @@
         return createConsumer( destination, selector, false );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
@@ -221,13 +218,12 @@
     const cms::Destination* destination,
     const std::string& selector,
     bool noLocal )
-        throw ( cms::CMSException )
-{
-    try
-    {
-        if( closed )
-        {
-            throw InvalidStateException(
+        throw ( cms::CMSException ) {
+
+    try{
+
+        if( closed ) {
+            throw ActiveMQException(
                 __FILE__, __LINE__,
                 "ActiveMQSession::createConsumer - Session Already Closed" );
         }
@@ -272,6 +268,7 @@
         return consumer;
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
@@ -281,13 +278,12 @@
     const std::string& name,
     const std::string& selector,
     bool noLocal )
-        throw ( cms::CMSException )
-{
-    try
-    {
-        if( closed )
-        {
-            throw InvalidStateException(
+        throw ( cms::CMSException ) {
+
+    try{
+
+        if( closed ) {
+            throw ActiveMQException(
                 __FILE__, __LINE__,
                 "ActiveMQSession::createDurableConsumer - Session Already Closed" );
         }
@@ -329,19 +325,19 @@
         return consumer;
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 cms::MessageProducer* ActiveMQSession::createProducer(
     const cms::Destination* destination )
-        throw ( cms::CMSException )
-{
-    try
-    {
-        if( closed )
-        {
-            throw InvalidStateException(
+        throw ( cms::CMSException ) {
+
+    try{
+
+        if( closed ) {
+            throw ActiveMQException(
                 __FILE__, __LINE__,
                 "ActiveMQSession::createProducer - Session Already Closed" );
         }
@@ -361,18 +357,17 @@
         return producer;
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 cms::Queue* ActiveMQSession::createQueue( const std::string& queueName )
-    throw ( cms::CMSException )
-{
-    try
-    {
-        if( closed )
-        {
-            throw InvalidStateException(
+    throw ( cms::CMSException ) {
+
+    try{
+        if( closed ) {
+            throw ActiveMQException(
                 __FILE__, __LINE__,
                 "ActiveMQSession::createQueue - Session Already Closed" );
         }
@@ -387,18 +382,18 @@
         return queue;
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 cms::Topic* ActiveMQSession::createTopic( const std::string& topicName )
-    throw ( cms::CMSException )
-{
-    try
-    {
-        if( closed )
-        {
-            throw InvalidStateException(
+    throw ( cms::CMSException ) {
+
+    try{
+
+        if( closed ) {
+            throw ActiveMQException(
                 __FILE__, __LINE__,
                 "ActiveMQSession::createTopic - Session Already Closed");
         }
@@ -413,18 +408,18 @@
         return topic;
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 cms::TemporaryQueue* ActiveMQSession::createTemporaryQueue()
-    throw ( cms::CMSException )
-{
-    try
-    {
-        if( closed )
-        {
-            throw InvalidStateException(
+    throw ( cms::CMSException ) {
+
+    try{
+
+        if( closed ) {
+            throw ActiveMQException(
                 __FILE__, __LINE__,
                 "ActiveMQSession::createTemporaryQueue - "
                 "Session Already Closed" );
@@ -442,18 +437,17 @@
         return queue;
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 cms::TemporaryTopic* ActiveMQSession::createTemporaryTopic()
-    throw ( cms::CMSException )
-{
-    try
-    {
-        if( closed )
-        {
-            throw InvalidStateException(
+    throw ( cms::CMSException ) {
+    try{
+
+        if( closed ) {
+            throw ActiveMQException(
                 __FILE__, __LINE__,
                 "ActiveMQSession::createTemporaryTopic - "
                 "Session Already Closed" );
@@ -471,18 +465,17 @@
         return topic;
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 cms::Message* ActiveMQSession::createMessage()
-    throw ( cms::CMSException )
-{
-    try
-    {
-        if( closed )
-        {
-            throw InvalidStateException(
+    throw ( cms::CMSException ) {
+
+    try{
+        if( closed ) {
+            throw ActiveMQException(
                 __FILE__, __LINE__,
                 "ActiveMQSession::createMessage - Session Already Closed" );
         }
@@ -497,18 +490,17 @@
         return message;
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 cms::BytesMessage* ActiveMQSession::createBytesMessage()
-    throw ( cms::CMSException )
-{
-    try
-    {
-        if( closed )
-        {
-            throw InvalidStateException(
+    throw ( cms::CMSException ) {
+
+    try{
+        if( closed ) {
+            throw ActiveMQException(
                 __FILE__, __LINE__,
                 "ActiveMQSession::createBytesMessage - Session Already Closed" );
         }
@@ -523,6 +515,7 @@
         return message;
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
@@ -530,10 +523,9 @@
 cms::BytesMessage* ActiveMQSession::createBytesMessage(
     const unsigned char* bytes,
     std::size_t bytesSize )
-        throw ( cms::CMSException )
-{
-    try
-    {
+        throw ( cms::CMSException ) {
+
+    try{
         BytesMessage* msg = createBytesMessage();
 
         msg->setBodyBytes( bytes, bytesSize );
@@ -541,18 +533,18 @@
         return msg;
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 cms::TextMessage* ActiveMQSession::createTextMessage()
-    throw ( cms::CMSException )
-{
-    try
-    {
-        if( closed )
-        {
-            throw InvalidStateException(
+    throw ( cms::CMSException ) {
+
+    try{
+
+        if( closed ) {
+            throw ActiveMQException(
                 __FILE__, __LINE__,
                 "ActiveMQSession::createTextMessage - Session Already Closed" );
         }
@@ -567,15 +559,16 @@
         return message;
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 cms::TextMessage* ActiveMQSession::createTextMessage( const std::string& text )
-    throw ( cms::CMSException )
-{
-    try
-    {
+    throw ( cms::CMSException ) {
+
+    try {
+
         TextMessage* msg = createTextMessage();
 
         msg->setText( text.c_str() );
@@ -583,18 +576,18 @@
         return msg;
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 cms::MapMessage* ActiveMQSession::createMapMessage()
-    throw ( cms::CMSException )
-{
-    try
-    {
-        if( closed )
-        {
-            throw InvalidStateException(
+    throw ( cms::CMSException ) {
+
+    try{
+
+        if( closed ) {
+            throw ActiveMQException(
                 __FILE__, __LINE__,
                 "ActiveMQSession::createMapMessage - Session Already Closed" );
         }
@@ -609,6 +602,7 @@
         return message;
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
@@ -629,21 +623,19 @@
 ////////////////////////////////////////////////////////////////////////////////
 void ActiveMQSession::acknowledge( ActiveMQConsumer* consumer,
                                    ActiveMQMessage* message )
-    throw ( cms::CMSException )
-{
-    try
-    {
-        if( closed )
-        {
-            throw InvalidStateException(
+    throw ( cms::CMSException ) {
+
+    try{
+
+        if( closed ) {
+            throw ActiveMQException(
                 __FILE__, __LINE__,
                 "ActiveMQSession::acknowledgeMessage - Session Already Closed" );
         }
 
         // Stores the Message and its consumer in the tranasction, if the
         // session is a transactional one.
-        if( isTransacted() )
-        {
+        if( isTransacted() ) {
             transaction->addToTransaction( message, consumer );
         }
 
@@ -655,18 +647,18 @@
                 dynamic_cast< cms::Message* >( message ) );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void ActiveMQSession::send( cms::Message* message, ActiveMQProducer* producer )
-    throw ( cms::CMSException )
-{
-    try
-    {
-        if( closed )
-        {
-            throw InvalidStateException(
+    throw ( cms::CMSException ) {
+
+    try {
+
+        if( closed ) {
+            throw ActiveMQException(
                 __FILE__, __LINE__,
                 "ActiveMQSession::onProducerClose - Session Already Closed" );
         }
@@ -676,6 +668,7 @@
             getConnector()->send( message, producer->getProducerInfo() );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
@@ -685,9 +678,8 @@
 
     try{
 
-        if( closed )
-        {
-            throw InvalidStateException(
+        if( closed ) {
+            throw ActiveMQException(
                 __FILE__, __LINE__,
                 "ActiveMQSession::onProducerClose - Session Already Closed");
         }
@@ -695,8 +687,8 @@
         const ConsumerInfo* consumer =
             dynamic_cast<const ConsumerInfo*>( resource );
 
-        if( consumer != NULL )
-        {
+        if( consumer != NULL ) {
+
             // If the executor thread is currently running, stop it.
             bool wasStarted = isStarted();
             if( wasStarted ) {
@@ -758,14 +750,14 @@
         }
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 cms::ExceptionListener* ActiveMQSession::getExceptionListener()
 {
-    if( connection != NULL )
-    {
+    if( connection != NULL ) {
         return connection->getExceptionListener();
     }
 
@@ -774,13 +766,12 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 void ActiveMQSession::unsubscribe( const std::string& name )
-    throw ( CMSException )
-{
-    try
-    {
-        if( closed )
-        {
-            throw InvalidStateException(
+    throw ( CMSException ) {
+
+    try{
+
+        if( closed ) {
+            throw ActiveMQException(
                 __FILE__, __LINE__,
                 "ActiveMQSession::createConsumer - Session Already Closed" );
         }
@@ -789,6 +780,7 @@
         connection->getConnectionData()->getConnector()->unsubscribe( name );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
@@ -818,8 +810,8 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQSession::redispatch( decaf::util::Queue<DispatchData>& unconsumedMessages
)
-{
+void ActiveMQSession::redispatch( decaf::util::Queue<DispatchData>& unconsumedMessages
) {
+
     decaf::util::Queue<DispatchData> reversedList;
 
     // Copy the list in reverse order then clear the original list.
@@ -836,24 +828,24 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQSession::start()
-{
+void ActiveMQSession::start() {
+
     if( executor != NULL ) {
         executor->start();
     }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQSession::stop()
-{
+void ActiveMQSession::stop() {
+
     if( executor != NULL ) {
         executor->stop();
     }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-bool ActiveMQSession::isStarted() const
-{
+bool ActiveMQSession::isStarted() const {
+
     if( executor == NULL ) {
         return false;
     }



Mime
View raw message