users@jersey.java.net

[Jersey] Re: Issue with maven-wadl-plugin giving NullPointerException

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Thu, 05 May 2011 11:48:02 +0200

Hello Jason,

could you please share more info about this? I would like to fix this in
1.7 release which is closing..

Thanks,
Pavel

On 4/29/11 11:11 AM, Pavel Bucek wrote:
> Looks like a bug.
>
> Can you share some simple testcase (and expected output)?
>
> Fix could be as simple as relacing that line with:
>
> final ParamDocType paramDoc = (m == null ? null :
> _resourceDoc.getParamDoc( r.getResourceClass(), m.getMethod(), p));
>
> but I'm not really sure whether it doesn't break something else..
>
> (1.7 will be out soon (~2 weeks), so you should be able to use that
> version if me manage to fix it soon enough)
>
> Thanks,
> Pavel
>
> On 4/29/11 3:50 AM, Jason Erickson wrote:
>> I recently tried to update from Jersey 1.4 to Jersey 1.5 (and 1.6)
>> but my build started failing with the following stack trace:
>> java.lang.NullPointerException
>> at
>> com.sun.jersey.server.wadl.generators.resourcedoc.WadlGeneratorResourceDocSupport.createParam(WadlGeneratorResourceDocSupport.java:324)
>> at
>> com.sun.jersey.server.wadl.WadlBuilder.generateParam(WadlBuilder.java:266)
>> at
>> com.sun.jersey.server.wadl.WadlBuilder.generateResource(WadlBuilder.java:300)
>> at
>> com.sun.jersey.server.wadl.WadlBuilder.generateResource(WadlBuilder.java:350)
>> at
>> com.sun.jersey.server.wadl.WadlBuilder.generateResource(WadlBuilder.java:350)
>> at
>> com.sun.jersey.server.wadl.WadlBuilder.generateResource(WadlBuilder.java:271)
>> at
>> com.sun.jersey.server.wadl.WadlBuilder.generate(WadlBuilder.java:107)
>> at
>> com.sun.jersey.wadl.GenerateWadlMojo.createApplication(GenerateWadlMojo.java:285)
>> at
>> com.sun.jersey.wadl.GenerateWadlMojo.executeWithClasspath(GenerateWadlMojo.java:146)
>> at
>> com.sun.jersey.wadl.AbstractMojoProjectClasspathSupport.execute(AbstractMojoProjectClasspathSupport.java:101)
>> at
>> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
>> ... Some more to the stack trace, but just Maven stuff.
>>
>> I stepped into the code and I see that
>> WadlGeneratorResourceDocSupport.createParam, line 324 does a
>> m.getMethod(), but m is null because WadlBuilder.generateResource,
>> line 300 passes null to WadlBuilder.generateParam. The problem is
>> that it is trying to process a field (possibly erroneously because of
>> an @Autowired annotation?), so of course, there is no method.
>>
>> Is there a fix or workaround for this (besides just passing on the
>> generating of WADL)?
>>
>>
>
>