commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <phil.ste...@gmail.com>
Subject Re: [Math] Usage of "NullPointerException"
Date Thu, 05 Aug 2010 11:15:28 GMT
Gilles Sadowski wrote:
>> [...]
>>
>>> I think that using IAE instead of NPE does not bring any added value. It
>>> justs goes against standard usage: throw NPE when a reference is "null"
>>> and is not allowed to be so.
>>> As proposed in
>>>   https://issues.apache.org/jira/browse/MATH-401
>>> we could still do explicit checks for "null" but nevertheless throw the
>>> standard (non-specific and non localized) NPE.
>>>
>> The added value that I see is that an IAE designating which argument
>> that cannot be null is in fact null gives more specific information
>> to the caller (or production support person examining logs) than
>> just a propagated NPE.
> 
> Well, my initial post reported the inconsistency of throwing either NPE or
> IAE as a result of checking for "null". If we take that NPE signifies a bug
> in CM, then we can have the policy of throwing IAE when null is encountered
> (and never explicitly throw NPE from CM).
> 

+1 - that is what I meant by my option 1) above.

Phil
> 
> Gilles
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message