Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Apache Tomcat »

Re: [OT] a Collection of beans to store sql data

Christopher Schultz

2007-01-11

Replies:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bob,

Bob Hall wrote:
> You missed the essence of Chris's suggestion:
>
> "3. Throw an exception in your catch(SQLException) block."
>
> In other words, your catch block would "swallow" the SQLException
> should one occur.

Just to be clear, I usually don't advocate the swallowing of an
exception. I typically encourage the use of a wrapped exception, like this:

catch (SQLException sqle)
{
 throw new ApplicationSpecficException("Cannot query db", sqle);
}

Where the original exception is kept around, and even shows up in the
stack trace as the "root cause".

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFpk7w9CaO5/Lv0PARAkBoAKCMNUGNE9bUc6kQ5q3mJvUfTt58KQCfXF1N
LoAz/ziIrMX3iWIILCB1v5w=
=0itK
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@(protected)
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.