commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From __matthewHawthorne <>
Subject Re: [lang] NPEs in StringUtils
Date Wed, 16 Jul 2003 01:14:41 GMT
As I've stated before, I think that quiet null handling leads to errors
and confusion.  However, it probably makes more sense to adapt
StringUtils the rest of [lang], instead of the opposite.

An insight into my thinking can be presented in these two examples,
which are titled:

"Exceptions are for exceptional situations"

- isEmpty(null)

null isn't empty, but null isn't _not_ empty either.  So neither true or
false is correct.  This is an exceptional situation.

- chomp(null)

You can't chomp null.  You can refuse to chomp null and return null...
but in this case, the method isn't doing what it claims to do.  It's
_refusing_ to chomp instead of chomping.   This is an exceptional

I understand that this philosophy is more idealistic than practical. 

On Tue, 2003-07-15 at 17:30, Stephen Colebourne wrote:
> All this debate has reminded me that we have not sorted the position on null
> handling in StringUtils.
> Most of [lang] is quiet with respect to nulls wherever possible. I would
> like to extend that to StringUtils. Are there any objections to making this
> change? I feel a consistent position would be good.
> Now is the time to do this of course (pre 2.0). (Its amazing what you find
> when you want to do a release...)
> Stephen
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message