commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Juozas Baliuka" <>
Subject Re: [Lang] Validate! [was: Assertions?]
Date Tue, 22 Oct 2002 17:25:24 GMT

agree "Validation" is a better name for this stuff and it can throw "custom"

public class NotNullableArgValidationFailed extends IllegalArgumentExeption
user can catch "IAE" but will be more clear. Somebody can think argument is
"bad" for validation  function, not for caller in some third party code.

Validation makes a lot more sense to me, also. [Boy, my sister in law came
visit for the weekend, and I'm behind by over 100 messages]

In particular, although a number of the methods are trivial, some are not.
nulls in an Object array, for example, or null list elements. As long as all
the elements would be traversed anyway, it's not that much overhead, and
helps document the expectations of the rest of the code.

OTOH, I do have to ask if transforming a NPE to an IAE is really a win? Fail
fast is nice, though. And for non-null checks, eg isNotEmpty() or
isNotZero(), you may transform a silent error to an IAE.


On Tuesday 22 October 2002 03:00 am, Ola Berg wrote:
> From: "Paul Cantrell" <>
> > That's why it would probably be best to choose a method name which made
> > it clear that the method is for argument validation, not null checking
> > in general.
> Validate it is then!
> > I actually use IllegalStateException rather often, and
> > UnsupportedOperation on occasion.
> Of course we use a lot of different exceptions. But for validating risky
> (aka user provided) arguments (which is what we have in mind), IAE is very
> appropriate.
> From: "Stephen Colebourne" <>
> > I have a class like this at both work (called Assert) and in the Joda
> > project (called Validate).
> Me to (but they are called Assert). Why can't you, Stephen, check some of
> this in (into lang sandbox?) so that we can have a go at it?
> /O

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

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

View raw message