camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Validator component + onException
Date Tue, 21 Aug 2012 10:44:45 GMT
Hi

What OS and Camel version are you using?
And have you tried upgrading to newer releases?
And you can also try to load the content into memory before the
validator, eg using a .convertBodyTo(String.class) etc.


On Tue, Aug 21, 2012 at 12:24 PM, livensn <nicklivens@gmail.com> wrote:
> Hi all,
>
> I got the following camel route :
>
> from("direct:customerroute")
>                 .log("File was found in directory: " + customersFolder)
>                 .choice()
>                 .when(simple("${file:ext} == 'xml' || ${file:ext} ==
> 'XML'"))
>                 .log("XML file recognized")
>                 .to("validator:" + xsdAddress + "/" + customersXsd)
>                 .to("xslt:" + xslAddress + "/" + customersXsl)
>                 .unmarshal(jaxbCustomersFormat)
>                 .process(customerProcessor)
>                 .end()
>
> Now when a ValidationException occurs, I catch it with the following
> configuration :
>
>         onException(Exception.class)
>                 .process(new Processor() {
>                     public void process(Exchange exchange) throws Exception
> {
>                         Exception exception = (Exception)
> exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
>                         LOGGER.error("Unexpected exception!", exception);
>                     }
>                 })
>                 .to("file://" + errorPath)
>                 .handled(true);
>
> The exception gets logged perfectly, so the onException works.
> But when we come to the part where he wants to delete the original file
> after copying it to the error folder, camel throws this exception :
> "Renaming file from: ... to: ... failed due cannot delete from file: ...
> after copy succeeded"
>
> So I think that this ValidatorProcessor doesn't close the stream to the file
> after an exception, and therefor it can't be deleted.
>
> Or I might of configured something wrong / misunderstood something. Any help
> would be appreciated :)
>
> Best regards,
>
> Nick
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Validator-component-onException-tp5717756.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



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

Mime
View raw message