You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Markus Frisch (JIRA)" <ji...@apache.org> on 2014/01/29 22:22:11 UTC

[jira] [Commented] (OPENEJB-2068) OpenEJB runs EJB Business Interface Method on Proxy instead of Bean

    [ https://issues.apache.org/jira/browse/OPENEJB-2068?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13885826#comment-13885826 ] 

Markus Frisch commented on OPENEJB-2068:
----------------------------------------

I have done some debugging and I think the problem comes from the method {{org.apache.openejb.util.proxy.LocalBeanProxyFactory.isOverridden()}}.
This method prevents OpenEJB from creating a proxy method for the bridge method that was inserted by the compiler. OpenEJB emits byte code for a proxy method for 
{code}
public List<Book> BookService.getAllBooks()
{code}
but the synthetic method {{Collection BookService.getAllBooks()}} is ignored because it differs only in return type.

If my understanding of the code is correct, it is sufficient to alter {{org.apache.openejb.util.proxy.LocalBeanProxyFactory. isOverridden()}} to also compare the return type of both methods:

{code}
    private static boolean isOverridden(final List<Method> methods, final Method method) {
        for (final Method m : methods) {
            if (Arrays.equals(m.getParameterTypes(), method.getParameterTypes())
                && m.getReturnType().equals(method.getReturnType())) {
                return true;
            }
        }
        return false;
    }
{code}

> OpenEJB runs EJB Business Interface Method on Proxy instead of Bean
> -------------------------------------------------------------------
>
>                 Key: OPENEJB-2068
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-2068
>             Project: OpenEJB
>          Issue Type: Bug
>            Reporter: Markus Frisch
>         Attachments: BridgeMethodBug.zip
>
>
> If an EJB overrides a method of a base class with a narrowed return type, OpenEJB runs the method on the dynamic proxy instead of the EJB class.
> I have prepared a slightly modified version of the DemoApp that is created by the maven-tomes-plugin that shows the effect.
> If you run it on tomee and try to list the available books, you get an NPE in BookService.getAllBooks() and the System.err-Stream shows the message:
> > getAllBooks called on class de.nobiscum.mff.bridgemethodbug.application.BookService$$LocalBeanProxy



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)