[ 
https://issues.apache.org/jira/browse/OWB-309?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12838590#action_12838590
 ] 

David Blevins commented on OWB-309:
-----------------------------------

And here's how we have that implemented in OpenEJB

Obviously this is for the InvocationContext impl

{code}
    public Object proceed() throws Exception {
        // The bulk of the logic of this method has intentionally been moved
        // out so stepping through a large stack in a debugger can be done 
quickly.
        // Simply put one break point on 'next.invoke()' or one inside that 
method.
        try {
            Invocation next = next();
            return next.invoke();
        } catch (InvocationTargetException e) {
            throw unwrapInvocationTargetException(e);
        }
    }

    /**
     * Business method interceptors can only throw exception allowed by the 
target business method.
     * Lifecycle interceptors can only throw RuntimeException.
     * @param e the invocation target exception of a reflection method invoke
     * @return the cause of the exception
     * @throws AssertionError if the cause is not an Exception or Error.
     */
    private Exception unwrapInvocationTargetException(InvocationTargetException 
e) {
        Throwable cause = e.getCause();
        if (cause == null) {
            return e;
        } else if (cause instanceof Exception) {
            return (Exception) cause;
        } else if (cause instanceof Error) {
            throw (Error) cause;
        } else {
            throw new AssertionError(cause);
        }
    }
{code}

> signature check for @Interceptors-enabled interceptors is too strict
> --------------------------------------------------------------------
>
>                 Key: OWB-309
>                 URL: https://issues.apache.org/jira/browse/OWB-309
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Interceptor and Decorators
>    Affects Versions: M3
>            Reporter: Eric Covener
>            Assignee: Eric Covener
>            Priority: Minor
>             Fix For: M4
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Sometimes having the wrong kind of signature (defined in bean class vs. 
> defined in an interceptor) just means the method is n/a to the current bean 
> we're looking at.  Don't throw an exception for an unexpected 
> InvocationContext, just don't enable the method.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to