Agreed. There are only a few cases where the second is appropriate. The
first is a bad idea, since it does not propagate the exception state to the
parent calling context. Also, please avoid direct printStackTrace()
calls, instead using log.error("some message", e); to log the exception, or
warning/debug as appropriate.
--jason
On Wed, 12 Sep 2001, toby cabot wrote:
> Folks,
>
> Thanks for your efforts on JBoss. It's awesome. I believe that I
> earned this rant by cleaning up the file where I found these problems
> and submitting it to the patch manager on sf.net:
>
> I just spent much more time than necessary to track down a bug that got
> hidden by some code that looked like:
>
> } catch (Exception e) {
> e.printStackTrace();
> }
>
> I found this in the same file:
>
> } catch (Exception e) {}
>
> This is bad because it catches *any* exceptions that happen in the try
> block, not just the ones that you're likely to be able to handle. This
> makes debugging much harder because the system emits much less useful
> information about the exception. I understand that it takes more time
> to catch specific errors and deal with them but it makes the system
> *much* more resilient.
>
> Please, please, make sure that you catch only what your code can
> properly deal with, and let everything else percolate up.
>
> Regards,
> Toby Cabot
>
>
>
> _______________________________________________
> Jboss-development mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-development
>
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development