You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Glebow, Philip" <Ph...@blackrock.com> on 2011/07/26 00:54:31 UTC

Try-Catch-Finally and handled(false)

Hello,

  I'm using the try-catch-finally feature in Camel 2.7.0.  According to
the source (TryDefinition.java, line 183), the handled(boolean) method
is marked as deprecated and will be removed in Camel 3.0.  My
application uses the handled(boolean) method to rethrow an exception.
For example, if the application is unable to connect to an SFTP server,
the exception is re-thrown so specialized file handling & reporting
processes can be initiated.  It's important for the initiating component
(a file:/// component) to know that the exception wasn't handled so it
can make use of the directory specified via the moveFailed parameter.  

  Is there a recommended alternative approach?
http://camel.apache.org/try-catch-finally.html does not seem to indicate
one.  Thanks.

Phil

THIS MESSAGE AND ANY ATTACHMENTS ARE CONFIDENTIAL, PROPRIETARY, AND MAY BE PRIVILEGED.  If this message was misdirected, BlackRock, Inc. and its subsidiaries, ("BlackRock") does not waive any confidentiality or privilege.  If you are not the intended recipient, please notify us immediately and destroy the message without disclosing its contents to anyone.  Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized.  The views and opinions expressed in this e-mail message are the author's own and may not reflect the views and opinions of BlackRock, unless the author is authorized by BlackRock to express such views or opinions on its behalf.  All email sent to or from this address is subject to electronic storage and review by BlackRock.  Although BlackRock operates anti-virus programs, it does not accept responsibility for any damage whatsoever caused by viruses being passed.


   

Re: Try-Catch-Finally and handled(false)

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Jul 26, 2011 at 12:54 AM, Glebow, Philip
<Ph...@blackrock.com> wrote:
> Hello,
>
>  I'm using the try-catch-finally feature in Camel 2.7.0.  According to
> the source (TryDefinition.java, line 183), the handled(boolean) method
> is marked as deprecated and will be removed in Camel 3.0.  My
> application uses the handled(boolean) method to rethrow an exception.
> For example, if the application is unable to connect to an SFTP server,
> the exception is re-thrown so specialized file handling & reporting
> processes can be initiated.  It's important for the initiating component
> (a file:/// component) to know that the exception wasn't handled so it
> can make use of the directory specified via the moveFailed parameter.
>
>  Is there a recommended alternative approach?
> http://camel.apache.org/try-catch-finally.html does not seem to indicate
> one.  Thanks.
>

Just do as you would do in regular try .. catch in Java, rethrow the
exception yourself.


> Phil
>
> THIS MESSAGE AND ANY ATTACHMENTS ARE CONFIDENTIAL, PROPRIETARY, AND MAY BE PRIVILEGED.  If this message was misdirected, BlackRock, Inc. and its subsidiaries, ("BlackRock") does not waive any confidentiality or privilege.  If you are not the intended recipient, please notify us immediately and destroy the message without disclosing its contents to anyone.  Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized.  The views and opinions expressed in this e-mail message are the author's own and may not reflect the views and opinions of BlackRock, unless the author is authorized by BlackRock to express such views or opinions on its behalf.  All email sent to or from this address is subject to electronic storage and review by BlackRock.  Although BlackRock operates anti-virus programs, it does not accept responsibility for any damage whatsoever caused by viruses being passed.
>
>
>
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/