commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Colebourne" <scolebou...@btopenworld.com>
Subject Re: [lang] StringUtils.containsOnly
Date Thu, 26 Sep 2002 17:18:31 GMT
From: "Steve Downey" <steve.downey@netfolio.com>
On Thursday 26 September 2002 04:54 am, Stephen Colebourne wrote:
> > My view is that one of the main advantages of StringUtils is to avoid
NPEs.
> > I actually thought that we'd been through all the methods and ensured
that
> > none of them did throw a NPE.
>
> I think that's overkill. You have to decide what to do with null, and
often
> the right thing to do is throw an NPE. Treating null as "" generally isn't
a
> good idea. If that's what you want, using StringUtils.clean() in the
calling
> code works.

I go further than this - in my world a product like [lang] would never throw
NPEs. If it did then that would be a bug. If null is a disallowed parameter
then that should be checked and thrown as an IllegalArgumentException. But
thats just my coding style.

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


--
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