users@jersey.java.net

Re: [Jersey] WADL generator resource loading uses the wrong class loader

From: Jakub Podlesak <Jakub.Podlesak_at_Sun.COM>
Date: Fri, 20 Feb 2009 13:57:43 +0100

On Fri, Feb 20, 2009 at 01:04:23PM +0100, Paul Sandoz wrote:
>
> On Feb 20, 2009, at 11:47 AM, Jakub Podlesak wrote:
>
>> On Fri, Feb 20, 2009 at 11:30:49AM +0100, Martin Grotzke wrote:
>>> Hi Jakub,
>>>
>>> I just modified the GenerateWadlMojo so that it creates a more
>>> informative error message (which property fails).
>>>
>>> Can you svn update and build/install the maven-wadl-plugin and try
>>> again?
>>
>> Sure, please see the new output log attached,
>>
>
> The problem is that i think Class.getConstructors() returns an array whose
> elements are not sorted and not in any particular order (although that is
> not stated in the JavaDoc, which is stated for returning of methods).
>
> The following code should check that the number of parameters is equal to
> one:
>
> private Constructor<?> getMatchingConstructor( final Class<?>
> paramClazz,
> final Object propertyValue ) {
> final Constructor<?>[] constructors = paramClazz.getConstructors();
> for ( Constructor<?> constructor : constructors ) {
> final Class<?>[] parameterTypes =
> constructor.getParameterTypes();
> if ( parameterTypes.length > 0

changed the above condition to parameterTypes.length == 1

~Jakub


> && constructor.getParameterTypes()[0] ==
> propertyValue.getClass() ) {
> return constructor;
> }
> }
> return null;
> }
>
> Paul.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>