commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ola Berg <>
Subject Re: [commons]NPE or IAE?
Date Thu, 22 Aug 2002 00:02:14 GMT
dion writes:
>NPEs for the illegal nulls. From the JDK docs:
>Thrown when an application attempts to use null in a case where an object 
>is required. These include: 
>Calling the instance method of a null object. 
>Accessing or modifying the field of a null object. 
>Taking the length of null as if it were an array. 
>Accessing or modifying the slots of null as if it were an array. 
>Throwing null as if it were a Throwable value. 
>Applications should throw instances of this class to indicate other 
>illegal uses of the null object. 

Sure, we know that. 

But also from the JDK docs:
Thrown to indicate that a method has been passed an illegal or inappropriate argument. 

If using null as an argument is illegal in some method, it is _both_ an illegal use of null,
as well as an inappropriate/illegal argument, so the question remains open. 

I asked if and how commons would like to close this question for themselves (since I am contributing
and would like to know the commons view). I\'ve seen and used both approaches and have no
_problem_ with any of them (but I favor the IAE-only way since it seems more logical).

(This was supposed to be a quickie... I have some code to write...hmm) Since the people responding
seem to prefer both NPE and IAE, I stick to that, until you decide something else.

Thanks for your valuable input.


0733 - 99 99 17

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

View raw message