users@jersey.java.net

Re: [Jersey] jersey + spring minor bug

From: Martin Grotzke <martin.grotzke_at_freiheit.com>
Date: Sun, 18 Jan 2009 18:30:42 +0100

Hi Pedro,

in the line

   ClassUtils.getUserClass( springContext.getType(name) );

it seems as if the type of the bean with the given name (coming from
springContext.getBeanDefinitionNames()) cannot be determined. The
javadoc of BeanFactory.getType [1] states referring to the return-value:

   Returns: the type of the bean, or null if not determinable

And ClassUtils.getUserClass just returns null if the input is null.

So we should really check for which of your beans the type cannot be
determined. Can you findout for which of your beans that is the case?

Cheers,
Martin


[1] http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/beans/factory/BeanFactory.html#getType(java.lang.String)



On Sun, 2009-01-18 at 12:15 +0100, Martin Grotzke wrote:
> Hi Pedro,
>
> could you provide some more details how to reproduce this issue? E.g.
> for what classes/types you have this issue, the definition in the
> applicationContext, which spring version etc. Or is this an issue for
> types that are no spring beans at all?
>
> Thx && cheers,
> Martin
>
>
>
> On Sat, 2009-01-17 at 03:28 -0200, Pedro Teixeira wrote:
> > hi there,
> >
> > I'm just trying out version 1.0.1 and stumbled an annoying problem
> > when the servelet is registering types.
> >
> > Fo some reason (not sure yet), a given type is returning null from the
> > springContext.getType method.
> >
> > My current fix is to actually handle this possible null return in
> > jersey's code, as follows:
> >
> > Class<?> type =
> > ClassUtils.getUserClass( springContext.getType(name) );
> > ** add this ** if(type == null) continue;
> > if (ResourceConfig.isProviderClass(type)) {
> > ----
> >
> > would be nice to have the check in the next realase ;)
> >
> > []'s
> > Pedro
-- 
Martin Grotzke
http://www.javakaffee.de/blog/