commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rodney Waldhoff <>
Subject RE: Checked vs Runtime exceptions
Date Wed, 25 Jun 2003 00:14:47 GMT
On Tue, 24 Jun 2003, David Graham wrote:

> RuntimeExceptions indicate programmer error.

I'll agree with that.

> In rare
> cases they are thrown when you must bypass several
> application layers (see SecurityException for an
> example).

Precisely.  And sometimes you must bypass several (one or more)
application layers without knowledge of the underlying type of exception.
That's the role of TunneledException in my mind.  Frameworks like
commons-pool, and to a greater extent, commons-functor, are likely to fall
into this situation.  Framework specific wrappers (PoolException,
FunctorException), but seem, well, redudant, but more importantly explode
in complexity when the framworks are composed.  (E.g., if I have a functor
based pool, will pool throw PoolException wrapping FunctorException
wrapping Exception, or will the pool unwrap the underlying Exception and
wrap it in the PoolException?  Does the calling code need to know?)

I'm not suggesting that every place we throw a checked Exception we should
convert it to a wrapped RuntimeException, but I am suggesting that any
place we've got or might want "throws Exception" a less verbose solution
*might* be appropriate.

- Rod <>

> David

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

View raw message