Hi, agree "Validation" is a better name for this stuff and it can throw "custom" exeptions.
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 to 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. No 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. $0.02. On Tuesday 22 October 2002 03:00 am, Ola Berg wrote: > From: "Paul Cantrell" <[EMAIL PROTECTED]> > > > 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" <[EMAIL PROTECTED]> > > > 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: <mailto:commons-dev-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:commons-dev-help@;jakarta.apache.org> -- To unsubscribe, e-mail: <mailto:commons-dev-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:commons-dev-help@;jakarta.apache.org>
