You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2013/02/26 23:36:15 UTC
svn commit: r1450496 - in
/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq:
core/ActiveMQConnection.cpp util/CMSExceptionSupport.h
Author: tabish
Date: Tue Feb 26 22:36:15 2013
New Revision: 1450496
URL: http://svn.apache.org/r1450496
Log:
https://issues.apache.org/jira/browse/AMQCPP-467
Pulls out wrapped CMSException types and throws a valid copy.
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CMSExceptionSupport.h
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp?rev=1450496&r1=1450495&r2=1450496&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp Tue Feb 26 22:36:15 2013
@@ -648,9 +648,7 @@ void ActiveMQConnection::close() {
this->stop();
} catch (cms::CMSException& error) {
if (!hasException) {
- // TODO need more work on throwning specific CMSExceptions.
- // ex = Exception(new CMSException(error));
- ex = Exception(__FILE__, __LINE__, error.getMessage().c_str());
+ ex = ActiveMQException(error.clone());
hasException = true;
}
}
@@ -714,9 +712,7 @@ void ActiveMQConnection::close() {
}
} catch (cms::CMSException& error) {
if (!hasException) {
- // TODO need more work on throwning specific CMSExceptions.
- // ex = Exception(new CMSException(error));
- ex = Exception(__FILE__, __LINE__, error.getMessage().c_str());
+ ex = ActiveMQException(error.clone());
hasException = true;
}
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CMSExceptionSupport.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CMSExceptionSupport.h?rev=1450496&r1=1450495&r2=1450496&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CMSExceptionSupport.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CMSExceptionSupport.h Tue Feb 26 22:36:15 2013
@@ -34,6 +34,7 @@
#include <cms/TransactionInProgressException.h>
#include <cms/TransactionRolledBackException.h>
#include <cms/UnsupportedOperationException.h>
+#include <cms/XAException.h>
#include <decaf/lang/Exception.h>
@@ -109,10 +110,121 @@ namespace util {
} catch (cms::UnsupportedOperationException& ex) { \
ex.setMark(__FILE__, __LINE__); \
throw; \
+ } catch (cms::XAException& ex) { \
+ ex.setMark(__FILE__, __LINE__); \
+ throw; \
} catch (cms::CMSException& ex) { \
ex.setMark(__FILE__, __LINE__); \
throw; \
} catch (activemq::exceptions::ActiveMQException& ex) { \
+ if (ex.getCause() != NULL) { \
+ const std::exception* cause = ex.getCause(); \
+ { \
+ const cms::CMSSecurityException* exception = \
+ dynamic_cast<const cms::CMSSecurityException*>(cause); \
+ if (exception != NULL) { \
+ throw cms::CMSSecurityException(*exception); \
+ } \
+ } \
+ { \
+ const cms::IllegalStateException* exception = \
+ dynamic_cast<const cms::IllegalStateException*>(cause); \
+ if (exception != NULL) { \
+ throw cms::IllegalStateException(*exception); \
+ } \
+ } \
+ { \
+ const cms::InvalidClientIdException* exception = \
+ dynamic_cast<const cms::InvalidClientIdException*>(cause); \
+ if (exception != NULL) { \
+ throw cms::InvalidClientIdException(*exception); \
+ } \
+ } \
+ { \
+ const cms::InvalidDestinationException* exception = \
+ dynamic_cast<const cms::InvalidDestinationException*>(cause); \
+ if (exception != NULL) { \
+ throw cms::InvalidDestinationException(*exception); \
+ } \
+ } \
+ { \
+ const cms::InvalidSelectorException* exception = \
+ dynamic_cast<const cms::InvalidSelectorException*>(cause); \
+ if (exception != NULL) { \
+ throw cms::InvalidSelectorException(*exception); \
+ } \
+ } \
+ { \
+ const cms::MessageEOFException* exception = \
+ dynamic_cast<const cms::MessageEOFException*>(cause); \
+ if (exception != NULL) { \
+ throw cms::MessageEOFException(*exception); \
+ } \
+ } \
+ { \
+ const cms::MessageFormatException* exception = \
+ dynamic_cast<const cms::MessageFormatException*>(cause); \
+ if (exception != NULL) { \
+ throw cms::MessageFormatException(*exception); \
+ } \
+ } \
+ { \
+ const cms::MessageNotReadableException* exception = \
+ dynamic_cast<const cms::MessageNotReadableException*>(cause); \
+ if (exception != NULL) { \
+ throw cms::MessageNotReadableException(*exception); \
+ } \
+ } \
+ { \
+ const cms::MessageNotWriteableException* exception = \
+ dynamic_cast<const cms::MessageNotWriteableException*>(cause); \
+ if (exception != NULL) { \
+ throw cms::MessageNotWriteableException(*exception); \
+ } \
+ } \
+ { \
+ const cms::ResourceAllocationException* exception = \
+ dynamic_cast<const cms::ResourceAllocationException*>(cause); \
+ if (exception != NULL) { \
+ throw cms::ResourceAllocationException(*exception); \
+ } \
+ } \
+ { \
+ const cms::TransactionInProgressException* exception = \
+ dynamic_cast<const cms::TransactionInProgressException*>(cause); \
+ if (exception != NULL) { \
+ throw cms::TransactionInProgressException(*exception); \
+ } \
+ } \
+ { \
+ const cms::TransactionRolledBackException* exception = \
+ dynamic_cast<const cms::TransactionRolledBackException*>(cause); \
+ if (exception != NULL) { \
+ throw cms::TransactionRolledBackException(*exception); \
+ } \
+ } \
+ { \
+ const cms::UnsupportedOperationException* exception = \
+ dynamic_cast<const cms::UnsupportedOperationException*>(cause); \
+ if (exception != NULL) { \
+ throw cms::UnsupportedOperationException(*exception); \
+ } \
+ } \
+ { \
+ const cms::XAException* exception = \
+ dynamic_cast<const cms::XAException*>(cause); \
+ if (exception != NULL) { \
+ throw cms::XAException(*exception); \
+ } \
+ } \
+ { \
+ const cms::CMSException* exception = \
+ dynamic_cast<const cms::CMSException*>(cause); \
+ if (exception != NULL) { \
+ throw cms::CMSException(*exception); \
+ } \
+ } \
+ } \
ex.setMark(__FILE__, __LINE__); \
throw ex.convertToCMSException(); \
} catch(decaf::lang::Exception& ex){ \