Hi Nick,
I'm trying to reproduce the behaviour you've described on a WIN-XP box
however without any success so:
- Would it be possible for you to provide the full stacktrace where file
renaming fails?
- Can you reproduce the problem using the 2.10.1 release?
- Looking at your route you don't make use of the FileConsumer but the
DirectConsumer. So I assume you send a java.io.File object to this consumer
using ProducerTemplate, right? Or is it just a copy&paste typo as you posted
your route to the user forum?
Babak
livensn 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-tp5717756p5719718.html
Sent from the Camel - Users mailing list archive at Nabble.com.