Hi,

I would like to handle the xpath expression exception via a processor which
will inturn start a route to rename the file as error.

Have attached the trace of the error if i load a malformed xml. I have
hadled this as below:

Error:  trace.trace
<http://camel.465427.n5.nabble.com/file/n5755884/trace.trace>  

/               <onException>
                        
<exception>javax.xml.xpath.XPathExpressionException</exception>
                        <handled>
                                <constant>true</constant>
                        </handled>
                        <process ref="XPathErrorProcessor" />
                </onException>/

But i dont see it handled and don't fine the route in the processor
executed. I have tried with the 
<exception>org.apache.camel.builder.xml.InvalidXPathExpression</exception>
too.

The processor to handle the error :

    public final void process(final Exchange exchange)
                throws Exception {
        context = getContext();
        ftp = (String) exchange.getProperty("ftp")+
"&fastExistsCheck=true&download=false"+ "&move=${file:name}.err";
        file  = (String) exchange.getProperty("file");
        caused = exchange.getProperty(Exchange.EXCEPTION_CAUGHT,
Throwable.class);
        context.addRoutes(new XPathErrorProcessor(ftp, file));
        context.start();
    }

    @Override
    public final void configure() throws Exception {
            fromF(this.ftp).log( "Exception during xpath expression
extraction :" + caused.getMessage() + this.file);
    }
}





--
View this message in context: 
http://camel.465427.n5.nabble.com/Handle-XPathExpressionException-in-a-processor-tp5755884.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to