directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Knecht <fel...@apache.org>
Subject Re: svn commit: r944590 - in /directory/apacheds/trunk: core-api/src/main/java/org/apache/directory/server/core/interceptor/ core/src/main/java/org/apache/directory/server/core/ core/src/main/java/org/apache/directory/server/core/changelog/ core/src/main/j...
Date Sat, 15 May 2010 08:58:15 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> I would not add a @SuppressWarning for such a warning. It's not good to
> have an empty catch block, and we should at least add a comment (//
> expected) if it's really expected, or add some real log if not.
> 
> I don't think that an empty catch block is a good thing (except in tests)

IMO it's never good swallowing an exception without leaving a trace
(either propagate exception or log exception).
Apart from that we may run into another problem, when catching any
thrown exception using the general "catch (Exception e)":

"This method uses a try-catch block that catches Exception objects, but
Exception is not thrown within the try block, and RuntimeException is
not explicitly caught. It is a common bug pattern to say try { ... }
catch (Exception e) { something } as a shorthand for catching a number
of types of exception each of whose catch blocks is identical, but this
construct also accidentally catches RuntimeException as well, masking
potential bugs. "


So what shall we do - propagate or log?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkvuYicACgkQ2lZVCB08qHFJigCfe4ha2ToHocVsUxpFjLWAf1tI
QWcAnjKZxsdqrtT8iMn7NKdtsYe3q7wO
=DmL1
-----END PGP SIGNATURE-----

Mime
View raw message