Re: [Avalon4:Fortress] Eating Crow (was Changes to RoleManager)

Peter Donald <[email protected]>
Newsgroups gmane.comp.jakarta.avalon.apps.devel,gmane.comp.jakarta.avalon.devel
Message-ID <[email protected]>
On Fri, 13 Dec 2002 06:13, Peter Royal wrote:
> On Thursday, December 12, 2002, at 02:08  PM, Berin Loritsch wrote:
> > 1) We should *never* explicitly throw a NullPointerException.
> >    If an argument is required, throw an IllegalArgumentException
> >    instead.  The meaning of the error is much more clear.
>
> I'd actually prefer it the other way.. Why?
>
> Throw a NullPointerException when an argument that is expected is null.
>
> Use IllegalArgumentException when there is an argument supplied, but it
> is invalid for other reasons.

+1

And it is also the pattern used in JDK and other classes.

-- 
Cheers,

Peter Donald
*-----------------------------------------------------*
* "Faced with the choice between changing one's mind, *
* and proving that there is no need to do so - almost *
* everyone gets busy on the proof."                   *
*              - John Kenneth Galbraith               *
*-----------------------------------------------------*
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.