geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Dillon <ja...@coredevelopers.net>
Subject Re: [Error handling] NullPointer or IllegalArgument?
Date Thu, 14 Aug 2003 10:13:35 GMT
Haha!  Be that a lesson to you... I am never wrong... except for when I 
am wrong and then that is a different matter all together :-P

--jason


On Thursday, August 14, 2003, at 04:46  PM, James Strachan wrote:

>
> On Thursday, August 14, 2003, at 10:30  am, Jason Dillon wrote:
>
>>> Note on further checking - NPE is not an IAE. They're both 
>>> RuntimeExceptions but thats about it. Sorry Jason I think you're 
>>> mistaken - but it would have been nice though.
>>
>> Huh?  Was there another Jason on this thread...
>
> DOH - I misread your mail (that'll teach me for giving up caffeine) - 
> I thought you implied NPE extends IAE. Sorry Jason! You really said 
> this...
>
>> org.apache.geronimo.common.NullArgumentException extends IAE and 
>> handles the formatting of the message too, so you can:
>>
>> throw new NullArgumentException("address");
>
> So we can all just throw NullArgumentException instead - cool.
>
> To make life a little simpler if you're writing a method I've added a 
> wee helper method which checks for null & throws the exception if 
> required...
>
> public void doSomething(Foo foo, Bar bar) {
> 	NullArgumentException.checkForNull("foo", foo);
> 	NullArgumentException.checkForNull("bar", bar);
>
> 	...
> }
>
> James
> -------
> http://radio.weblogs.com/0112098/
>


Mime
View raw message