Also, if WorkflowException is your own, you might want consider
exception chaining. Sun included pretty good support for it since JDK
1.4.2
(http://java.sun.com/j2se/1.4.2/docs/guide/lang/chained-exceptions.html)
.

-----Original Message-----
From: Christopher Schultz [mailto:[EMAIL PROTECTED] 
Sent: Friday, November 10, 2006 10:44 AM
To: Struts Users Mailing List
Subject: Re: Java exception handling

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

Miro,

temp temp wrote:
> For good  exceptional handling  should I create  all my methods in try

> catch block and throw  exception in the catch block with
> e.printstacktrace()

I would recommend simply doing this:

> }catch(Exception  e) {
>          throw new  WorkflowException(e); }

Don't bother printing the stack trace.

Also, you might not want to catch /all/ Exceptions, but instead catch
those exceptions which are actually thrown. Of course, it is possible
that some methods you call are declared to "throws Exception", in which
case, you don't really have a choice.

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

iD8DBQFFVKxN9CaO5/Lv0PARAoKeAJ40D4TVjiyWLuQKrofS5R6Ofv4VKQCgsKTR
ZD5VL1wDK9OLIhh1FbfilbA=
=cLCI
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to