users@jersey.java.net

Re: [Jersey] Nullpointer exception in ExceptionMapper on jersey 1.1.5 (but not in 1.1.2)

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 04 Mar 2010 18:15:40 +0100

On Mar 4, 2010, at 3:50 PM, Morten wrote:

> Hi Paul,
>
> Thanks for identifying the bug. Look forward to v1.2 release :-)
>
> As for the inject, it was there also when I used 1.1.2 but I did not
> get the same error. It might have initialized to null instead though
> without me discovering it as the error handler was very forgiving.
>

Yes, it definitely would have been null :-)

Paul.

> --- Den tors 4/3/10 skrev Paul Sandoz <Paul.Sandoz_at_Sun.COM>:
>
>> Fra: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
>> Emne: Re: [Jersey] Nullpointer exception in ExceptionMapper on
>> jersey 1.1.5 (but not in 1.1.2)
>> Til: users_at_jersey.dev.java.net
>> Dato: torsdag 4. marts 2010 13.20
>> Hi Morten,
>>
>> This is issue 467 which is fixed in the 1.2-SNAPSHOT:
>>
>> https://jersey.dev.java.net/issues/show_bug.cgi?id=467
>>
>> I presume that you added the
>> @com.sun.jersey.spi.inject.Inject support to the 1.1.5
>> version of your ExceptonMapper because that functionality
>> was not supported in 1.1.2-ea?
>>
>> I will send another email about release plans.
>>
>> Paul.
>>
>> On Mar 3, 2010, at 11:09 PM, Morten wrote:
>>
>>> After a long break from java/jersey work I just
>> upgraded from jersey 1.1.2 to 1.1.5 and since then my
>> exception mapper fails to instantiate.
>>>
>>> The exception I get is:
>>> SEVERE: The provider class, class
>> com.myapp.controller.CustomExceptionMapper, could not be
>> instantiated. Processing will continue but the class will
>> not be utilized
>>> java.lang.NullPointerException
>>> at
>> com
>> .sun
>> .jersey
>> .server.impl.model.ResourceClass.processOptions(ResourceClass.java:
>> 374)
>>> at
>> com
>> .sun
>> .jersey
>> .server.impl.model.ResourceClass.processMethods(ResourceClass.java:
>> 323)
>>> at
>> com
>> .sun
>> .jersey.server.impl.model.ResourceClass.<init>(ResourceClass.java:
>> 133)
>>>
>>> My mapper looks like this:
>>>
>>> @Provider
>>> public class CustomExceptionMapper implements
>> ExceptionMapper<java.lang.Throwable> {
>>> private final Logger log =
>> Logger.getLogger(CustomExceptionMapper.class.getName());
>>>
>>> private UriInfo uriInfo;
>>>
>>> @com.sun.jersey.spi.inject.Inject
>>> protected WebServer server;
>>>
>>> public
>> CustomExceptionMapper(@Context UriInfo uriInfo) {
>>> this.uriInfo =
>> uriInfo;
>>> }
>>>
>>> public Response
>> toResponse(java.lang.Throwable ex) {
>>> // ...
>>> }
>>> }
>>>
>>>
>>> I suspect this is a bug in jersey... Any ideas/help
>> would be appreciated ?
>>>
>>> BTW: Any plans for a maintaince release of jersey
>> 1.1.x with bugfixes since release of 1.1.5 ?
>>>
>>> /Morten
>>>
>>>
>>>
>>> __________________________________________________
>>> Bruger du Yahoo!?
>>> Er du tręt af spam? Yahoo!Mail har den bedste
>> spambeskyttelse, der findes
>>> http://dk.mail.yahoo.com
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>>
>
> __________________________________________________
> Bruger du Yahoo!?
> Er du tręt af spam? Yahoo!Mail har den bedste spambeskyttelse, der
> findes
> http://dk.mail.yahoo.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>