geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <>
Subject Re: [Error handling] NullPointer or IllegalArgument?
Date Thu, 14 Aug 2003 16:37:37 GMT
Alex Blewitt wrote:

> Alex.
> (*) Yes, you could argue that it's a bad API, and that IOException 
> should be added to the throws clause. But particularly, when you're 
> dealing with an interface (e.g. java.util.Iterator) or an abstract 
> super-type (java.util.AbstractTreeModel) you don't often have the 
> ability to change the supertype method definition ...

Just create an IORuntimeException that can be caught that explicitly
holds the parent IOException....

THat approach is a documented pattern (can't remember where I've seen
it though).  I still prefer a typed exception to a generic one.


"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin

View raw message