jsr339-experts@jax-rs-spec.java.net

[jsr339-experts] Re: [jax-rs-spec users] Re: Replacing IllegalStateException in UriBuilder API with NPE?

From: Marek Potociar <marek.potociar_at_oracle.com>
Date: Fri, 15 Jun 2012 12:55:35 +0200

On Jun 11, 2012, at 12:31 PM, Sergey Beryozkin wrote:

> Hi
> On 05/06/12 16:59, Bill Burke wrote:
>> Isn't there TCK tests that test that ISE is thrown when null is passed in?
>>
>
> In some cases 'null' is valid (resetting some of the previous state), so it would be good to get some further clarifications on the issue
>
> NPE is associated with a code bug to me, I often see people saying NPE is always a bug in the code, so I wonder if such a replacement is really necessary

The point is that in this case the NPE really indicates a code bug. In fact, the exception thrown now (and declared in API) is IllegalArgumentException (sorry for the confusion) and it' s only purpose is to indicate a code bug too. It's just that by convention, NPE should be used for the null pointer related issues.

Marek

>
> Cheers, Sergey
>
>
>> On 6/5/12 11:05 AM, Marek Potociar wrote:
>>> Hello Experts,
>>> please provide your feedback: http://java.net/jira/browse/JAX_RS_SPEC-131
>>>
>>> Thanks,
>>> Marek
>>