[EMAIL PROTECTED] wrote:
Though at the end of the day, I just think developers should decide to make more judicious use of checked exceptions and not make a checked exception out of everything. For instance if all you ever do is catch that exception and throw a runtime exception, then it probably should have been one in the first place. I'd guess 90% of the checked exceptions I see in applications *shouldn't* be checked exceptions.
Agreed. The way I heard it put once is "throw a checked exception IF the calling method has a reasonable chance of being able to recover from
the exception. If the calling method is more likely to just rethrow it,
make it an unchecked exception."
If the author of the calling method is extremely ambitious / optimistic he/she still has the option of doing catch( Exception e ) or even catch( Throwable t) (the latter is generally NOT recommended!) and trying to handle everything.
Also, just to throw this in... something I've realized the hard way... if you catch and exception and then rethrow it, don't bother calling printStackTrace() on the exception object... Doing so just fills the logs up with useless redundant copies of the same stack-trace, and makes it that much harder to figure out what's going on.
Save logging the exception until it hits the code that finally decides there is not point in rethrowing, and either has to handle is, ignore it, abort the program or whatever... and use the exception chaining mechanism ( Throwable.initCause(), Throwable.getCause() ), so that
when you finally log the exception, you get everything back to the point
where it originally happened.
TTYL,
Phil
-- Vote Badnarik for President 2004 www.badnarik.org
FREE AMERICA Vote Libertarian www.lp.org
_______________________________________________ Juglist mailing list [EMAIL PROTECTED] http://trijug.org/mailman/listinfo/juglist_trijug.org
