From: dIon Gillard [mailto:[EMAIL PROTECTED]] > my call would be if these are illegal arguments, it should throw > IllegalArgumentException, not NullPointerException.
NullPointerException makes perfect sense in that case. The API documentation for NullPointerException specifically states it should be used to indicate an illegal use of a null object. While IllegalArgumentException is also applicable in the same sense -- an illegal value. The difference, for me at least, is that a NullPointerException provide more specific information as to what the problem is. It's also more common in the JDK to see NullPointerException thrown when a null argument is passed. In fact, I can't think of any places where an IllegalArgumentException is thrown when a null argument is passed, but know of a few where both are declared (one for invalid objects passed in, and the other when a null is passed). For example: http://java.sun.com/j2se/1.3/docs/api/java/lang/reflect/Array.html#get(j ava.lang.Object,%20int) declares it throws IllegalArgumentException *and* NullPointerException. NullPointer if the arg is null, and IllegalArgument if the arg is not an array. regards, michael -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
