You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by David Blevins <da...@gmail.com> on 2012/03/12 19:31:07 UTC

Re: svn commit: r1299611 - in /openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb: BeanContext.java core/ivm/EjbHomeProxyHandler.java util/proxy/DynamicProxyImplFactory.java

On Mar 12, 2012, at 5:15 AM, rmannibucau@apache.org wrote:

> +++ openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java Mon Mar 12 10:15:49 2012
> 
> +    private boolean hasField(final Class<?> clazz, final String name) {
> +        Class<?> current = clazz;
> +        while (current != null && !Object.class.equals(current)) {
> +            try {
> +                current.getDeclaredField(name);
> +                return true;
> +            } catch (NoSuchFieldException e) {
> +                // ignored
> +            }
> +        }
> +        return false;
> +    }

FYI, infinite loop.  "current" is never updated. :)

In general we can move all this special processing to the ConfigurationFactory side of things.  With one DynamicDeployer impl you could check if the bean is an @Proxy bean then check the handler for the specified field and add an env-entry of type java.lang.Class with the correct injection-target.


-David


Re: svn commit: r1299611 - in /openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb: BeanContext.java core/ivm/EjbHomeProxyHandler.java util/proxy/DynamicProxyImplFactory.java

Posted by Romain Manni-Bucau <rm...@gmail.com>.
ok, i take it
- Romain


2012/3/12 David Blevins <da...@gmail.com>

>
> On Mar 12, 2012, at 5:15 AM, rmannibucau@apache.org wrote:
>
> > +++
> openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java
> Mon Mar 12 10:15:49 2012
> >
> > +    private boolean hasField(final Class<?> clazz, final String name) {
> > +        Class<?> current = clazz;
> > +        while (current != null && !Object.class.equals(current)) {
> > +            try {
> > +                current.getDeclaredField(name);
> > +                return true;
> > +            } catch (NoSuchFieldException e) {
> > +                // ignored
> > +            }
> > +        }
> > +        return false;
> > +    }
>
> FYI, infinite loop.  "current" is never updated. :)
>
> In general we can move all this special processing to the
> ConfigurationFactory side of things.  With one DynamicDeployer impl you
> could check if the bean is an @Proxy bean then check the handler for the
> specified field and add an env-entry of type java.lang.Class with the
> correct injection-target.
>
>
> -David
>
>