Return-Path: Delivered-To: apmail-openwebbeans-commits-archive@www.apache.org Received: (qmail 51905 invoked from network); 26 Feb 2010 20:29:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 26 Feb 2010 20:29:59 -0000 Received: (qmail 18067 invoked by uid 500); 26 Feb 2010 20:29:58 -0000 Delivered-To: apmail-openwebbeans-commits-archive@openwebbeans.apache.org Received: (qmail 18035 invoked by uid 500); 26 Feb 2010 20:29:58 -0000 Mailing-List: contact commits-help@openwebbeans.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openwebbeans.apache.org Delivered-To: mailing list commits@openwebbeans.apache.org Received: (qmail 17994 invoked by uid 99); 26 Feb 2010 20:29:58 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Feb 2010 20:29:58 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.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; Fri, 26 Feb 2010 20:29:57 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id A7AD4238890B; Fri, 26 Feb 2010 20:29:37 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r916811 - /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java Date: Fri, 26 Feb 2010 20:29:37 -0000 To: commits@openwebbeans.apache.org From: covener@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100226202937.A7AD4238890B@eris.apache.org> Author: covener Date: Fri Feb 26 20:29:37 2010 New Revision: 916811 URL: http://svn.apache.org/viewvc?rev=916811&view=rev Log: OWB-305 when an exception bubbles up the interceptor, throw the actual cause from proceed() and not the InvocationTargetException that Method.invoke() has wrapped it in Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java?rev=916811&r1=916810&r2=916811&view=diff ============================================================================== --- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java (original) +++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java Fri Feb 26 20:29:37 2010 @@ -13,6 +13,7 @@ */ package org.apache.webbeans.intercept; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashMap; @@ -153,6 +154,22 @@ } } + catch (InvocationTargetException ite) + { + this.target = null; // destroy target instance + + // Try to provide the original exception to the interceptor stack, + // not the InvocationTargetException from Method.invoke + Throwable t = ite.getCause(); + if (t instanceof Exception) + { + throw (Exception) t; + } + else + { + throw ite; + } + } catch (Exception e) { this.target = null; // destroy target instance