users@jersey.java.net

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

From: Jason Erickson <jason_at_jasonerickson.com>
Date: Mon, 9 May 2011 17:56:04 -0700

OK, I logged an issue in JIRA about this (JERSEY-721) and attached a patch file for generate-wadl sample project that will reproduce the issue. (It's pretty simple.)

On May 5, 2011, at 2:48 AM, Pavel Bucek wrote:

> 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)?
>>>
>>>
>>
>>
>