created the issue: https://issues.apache.org/jira/browse/OPENEJB-1771

currently trying to commit a fix from the train :p

- Romain


2012/2/11 Romain Manni-Bucau <[email protected]>

> it sounds like a bug,
>
> thanks for the report,
>
> we'll have a deeper look ASAP
>
> - Romain
>
>
>
> 2012/2/11 Romain Manni-Bucau <[email protected]>
>
>> Hi,
>>
>> can you have a look at
>> http://svn.apache.org/repos/asf/openejb/trunk/openejb/container/openejb-core/src/test/java/org/apache/openejb/interceptors/InterceptorBindingEjbTest.java
>>  to
>> reproduce it please?
>>
>> - Romain
>>
>>
>>
>> 2012/2/11 og0815 <[email protected]>
>>
>>> Hi everybody,
>>>
>>> again I'm not 100% sure if I'm getting the spec right or found some bug.
>>>
>>> Assume the following code.
>>>
>>> @Inherited
>>> @InterceptorBinding
>>> @Retention(RUNTIME)
>>> @Target({METHOD, TYPE})
>>> public @interface MarkInterception {
>>> }
>>>
>>> ---
>>>
>>> @Interceptor
>>> @MarkInterception
>>> public class MarkedInterceptor {
>>>
>>>    @AroundInvoke
>>>    public Object manageTransaction(InvocationContext invocationContext)
>>> throws Exception {
>>>        System.out.println("Beginning Interceptor " + invocationContext);
>>>        Object o = invocationContext.proceed();
>>>        System.out.println("Ending Interceptor " + invocationContext);
>>>        return o;
>>>    }
>>> }
>>>
>>> ---
>>>
>>> @Stateless
>>> public class BeanOne {
>>>
>>>    @MarkInterception
>>>    public void something() {
>>>        System.out.println("BeanOne.something");
>>>    }
>>>
>>> }
>>>
>>> ---
>>>
>>> @Stateless
>>> public class BeanTwo {
>>>
>>>    @Inject
>>>    private BeanOne one;
>>>
>>>    public void callOne() {
>>>        one.something();
>>>    }
>>> }
>>>
>>> ---
>>>
>>> Now if I call BeanTwo.callOne in a client I get the following expected
>>> output:
>>>
>>> Beginning Interceptor InvocationContext(operation=BUSINESS,
>>> target=BeanOne,
>>> method=something)
>>> BeanOne.something
>>> Ending Interceptor InvocationContext(operation=BUSINESS, target=BeanOne,
>>> method=something)
>>>
>>> But, if I change the BeanTwo like this
>>>
>>> @Stateless
>>> public class BeanTwo {
>>>
>>>    @Inject
>>>    private BeanOne one;
>>>
>>>    @MarkInterception
>>>    public void doNothing() {
>>>
>>>    }
>>>
>>>    public void callOne() {
>>>        one.something();
>>>    }
>>>
>>> }
>>>
>>> the following happens:
>>>
>>> Beginning Interceptor InvocationContext(operation=BUSINESS,
>>> target=BeanTwo,
>>> method=callOne)
>>> Beginning Interceptor InvocationContext(operation=BUSINESS,
>>> target=BeanOne,
>>> method=something)
>>> BeanOne.something
>>> Ending Interceptor InvocationContext(operation=BUSINESS, target=BeanOne,
>>> method=something)
>>> Ending Interceptor InvocationContext(operation=BUSINESS, target=BeanTwo,
>>> method=callOne)
>>>
>>> Which means that also the callOne is now Intercepted. From my
>>> understanding
>>> the Interceptor annotation at method level should only intercept the
>>> selected method but in this case it looks like it has become a
>>> interceptor
>>> for all methods.
>>>
>>> Again am I doing something weird or is this a bug ?
>>>
>>> Thanks,
>>> Olli
>>>
>>>
>>> --
>>> View this message in context:
>>> http://openejb.979440.n4.nabble.com/Wrong-CDI-Interception-in-OpenEJB-tp4378502p4378502.html
>>> Sent from the OpenEJB Dev mailing list archive at Nabble.com.
>>>
>>
>>
>

Reply via email to