commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: [lang] StringUtils.containsOnly
Date Thu, 26 Sep 2002 19:28:32 GMT
Steve Downey wrote:
> On Thursday 26 September 2002 02:02 pm, Henri Yandell wrote:
> 
>>On Thu, 26 Sep 2002, Berin Loritsch wrote:
>>
>>>>Its probably a pity that we didn't agree a uniform approach to this,
>>>>but its too late now. The priority is to document what we have
>>>>correctly.
>>>>
>>>>Stephen
>>>
>>I don't think this is a problem. The too late now. If we go from
>>quiet->NPE it's a problem, but if we go from NPE->quiet behaviour then
>>it's merely seen as strengthening the API, no one can or should be
>>dependent on the NPE behaviour.
>>
>>Hen
> 
> Actually, I strongly disagree with that. Going from NPE to quiet is a major 
> change in behavior. Nulls will be treated as values, when they are not. 
> 
> And I wouldn't call it a strengthening of the API. It's a weakening of the 
> preconditions.
> 
> In any case, as I'm looking through right now, at least a few of the methods 
> that claim not to thow NPEs, do.

My point is not to remove the throwing of exceptions, but to throw an
exception that is more meaningful.  The NPE is automatically thrown by
the system if you try to perform an action on a null reference--AKA the
C++ pointer error analogy.  That is why I prefer to use
IllegalArgumentExceptions instead.  We are not weakening preconditions,
but we are letting the user of the API know where the problem is (in
the arguments passed in).


-- 

"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin


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


Mime
View raw message