directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lecharny <elecha...@apache.org>
Subject Re: [OT] How best to respond to null arguments?
Date Wed, 31 Aug 2005 20:54:45 GMT
A little bit of explanation about my 'vote' (didn't had time this
afternoon) :

On Wed, 2005-08-31 at 20:58 +0200, Emmanuel Lecharny wrote:
> option #3 +1
> option #1 -0
> option #2 -1

Considering that you need to check that an argument is not null, and
only this, means that if you pass a null, then it's an illegal argument.
We can express it by adding a message to the NPE, but isn't it much
better to use a self-explanatory exception like IAE ?

Doing nothing is of course the worst solution, as it may leads to non
predictable damages somewhere very far from the place where it should
have been detected.

> 
> What about using 'assert' ?

Well, as usual, it can be either considered as Angel or Evil. My point
was just that sometime, asserts could be a perfect candidate. Private
functions for instance. Whatever, this is not the place for a religious
war, so let have a post on TSS about asserts ;-) 

Emmanuel L├ęcharny





Mime
View raw message