Return-Path: X-Original-To: apmail-activemq-dev-archive@www.apache.org Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 29538659A for ; Thu, 26 May 2011 13:32:29 +0000 (UTC) Received: (qmail 84570 invoked by uid 500); 26 May 2011 13:32:28 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 84517 invoked by uid 500); 26 May 2011 13:32:28 -0000 Mailing-List: contact dev-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 dev@activemq.apache.org Received: (qmail 84340 invoked by uid 99); 26 May 2011 13:32:28 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 May 2011 13:32:28 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 May 2011 13:32:27 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id AB592E0FC1 for ; Thu, 26 May 2011 13:31:47 +0000 (UTC) Date: Thu, 26 May 2011 13:31:47 +0000 (UTC) From: "Martin Lepage (JIRA)" To: dev@activemq.apache.org Message-ID: <47934022.45300.1306416707697.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <2118619817.45291.1306416707410.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Updated] (AMQCPP-373) AMQ_CATCH_RETHROW upcasts the re-thrown exception MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/AMQCPP-373?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Martin Lepage updated AMQCPP-373: --------------------------------- Attachment: exception.patch A patch that solves the issue > AMQ_CATCH_RETHROW upcasts the re-thrown exception > ------------------------------------------------- > > Key: AMQCPP-373 > URL: https://issues.apache.org/jira/browse/AMQCPP-373 > Project: ActiveMQ C++ Client > Issue Type: Bug > Components: CMS Impl, Decaf > Affects Versions: 3.5.0 > Environment: Windows 7 (visual C++ 2005), Linux (gcc 4.1.2) > Reporter: Martin Lepage > Assignee: Timothy Bish > Priority: Minor > Labels: exception, exception_handling > Attachments: exception.patch > > Original Estimate: 0.25h > Remaining Estimate: 0.25h > > AMQ_CATCH_RETHROW and DECAF_CATCH_RETHROW as defined in {{activemq/exceptions/ExceptionDefines.h}} and {{decaf/lang/exceptions/ExceptionDefines.h}} upcast the exceptions when they rethrow it, which results in loss of information (but not of data) along the way. > Take for example the following c++ code fragment, which mimics the way AMQ_CATCH_RETHROW is used throughout the code : > {code:title=Exception handling|borderStyle=solid} > #include > #include > #include > #include > int main() > { > try > { > try > { > try > { > throw activemq::exceptions::BrokerException( > __FILE__, __LINE__, "Testing"); > } > AMQ_CATCH_RETHROW(activemq::exceptions::BrokerException) > } > AMQ_CATCH_RETHROW(activemq::exceptions::ActiveMQException) > } > catch (decaf::lang::Throwable &e) > { > std::cout.flags(std::ios_base::boolalpha); > std::cout << "Broker exception : " << (typeid(e).name() == > typeid(activemq::exceptions::BrokerException).name()) << "\n"; > std::cout << "ActiveMQException : " << (typeid(e).name() == > typeid(activemq::exceptions::ActiveMQException).name()) << "\n"; > > decaf::lang::Throwable *convertedException = > dynamic_cast(&e); > std::cout << "Conversion failed : " << (convertedException == NULL) > << "\n"; > } > return 0; > } > {code} > which returns : > {code:xml} > Broker exception : false > ActiveMQException : true > Conversion failed : true > {code} > The solution is to replace '{{throw e;}}' by '{{throw;}}' in the definitions of AMQ_CATCH_RETHROW and DECAF_CATCH_RETHROW. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira