Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4ED9DE73A for ; Tue, 26 Feb 2013 22:36:39 +0000 (UTC) Received: (qmail 26349 invoked by uid 500); 26 Feb 2013 22:36:39 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 26273 invoked by uid 500); 26 Feb 2013 22:36:39 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 26266 invoked by uid 99); 26 Feb 2013 22:36:39 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Feb 2013 22:36:39 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Feb 2013 22:36:36 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id C09AB2388847; Tue, 26 Feb 2013 22:36:15 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1450496 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq: core/ActiveMQConnection.cpp util/CMSExceptionSupport.h Date: Tue, 26 Feb 2013 22:36:15 -0000 To: commits@activemq.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130226223615.C09AB2388847@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 #include #include +#include #include @@ -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(cause); \ + if (exception != NULL) { \ + throw cms::CMSSecurityException(*exception); \ + } \ + } \ + { \ + const cms::IllegalStateException* exception = \ + dynamic_cast(cause); \ + if (exception != NULL) { \ + throw cms::IllegalStateException(*exception); \ + } \ + } \ + { \ + const cms::InvalidClientIdException* exception = \ + dynamic_cast(cause); \ + if (exception != NULL) { \ + throw cms::InvalidClientIdException(*exception); \ + } \ + } \ + { \ + const cms::InvalidDestinationException* exception = \ + dynamic_cast(cause); \ + if (exception != NULL) { \ + throw cms::InvalidDestinationException(*exception); \ + } \ + } \ + { \ + const cms::InvalidSelectorException* exception = \ + dynamic_cast(cause); \ + if (exception != NULL) { \ + throw cms::InvalidSelectorException(*exception); \ + } \ + } \ + { \ + const cms::MessageEOFException* exception = \ + dynamic_cast(cause); \ + if (exception != NULL) { \ + throw cms::MessageEOFException(*exception); \ + } \ + } \ + { \ + const cms::MessageFormatException* exception = \ + dynamic_cast(cause); \ + if (exception != NULL) { \ + throw cms::MessageFormatException(*exception); \ + } \ + } \ + { \ + const cms::MessageNotReadableException* exception = \ + dynamic_cast(cause); \ + if (exception != NULL) { \ + throw cms::MessageNotReadableException(*exception); \ + } \ + } \ + { \ + const cms::MessageNotWriteableException* exception = \ + dynamic_cast(cause); \ + if (exception != NULL) { \ + throw cms::MessageNotWriteableException(*exception); \ + } \ + } \ + { \ + const cms::ResourceAllocationException* exception = \ + dynamic_cast(cause); \ + if (exception != NULL) { \ + throw cms::ResourceAllocationException(*exception); \ + } \ + } \ + { \ + const cms::TransactionInProgressException* exception = \ + dynamic_cast(cause); \ + if (exception != NULL) { \ + throw cms::TransactionInProgressException(*exception); \ + } \ + } \ + { \ + const cms::TransactionRolledBackException* exception = \ + dynamic_cast(cause); \ + if (exception != NULL) { \ + throw cms::TransactionRolledBackException(*exception); \ + } \ + } \ + { \ + const cms::UnsupportedOperationException* exception = \ + dynamic_cast(cause); \ + if (exception != NULL) { \ + throw cms::UnsupportedOperationException(*exception); \ + } \ + } \ + { \ + const cms::XAException* exception = \ + dynamic_cast(cause); \ + if (exception != NULL) { \ + throw cms::XAException(*exception); \ + } \ + } \ + { \ + const cms::CMSException* exception = \ + dynamic_cast(cause); \ + if (exception != NULL) { \ + throw cms::CMSException(*exception); \ + } \ + } \ + } \ ex.setMark(__FILE__, __LINE__); \ throw ex.convertToCMSException(); \ } catch(decaf::lang::Exception& ex){ \