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.

Reply via email to