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 <[email protected]> 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: [email protected]
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to