camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Lee <>
Subject File2 Component's GenericFileOperationFailedException and its code attribute
Date Tue, 11 Sep 2012 10:22:44 GMT
Hello there,
I'm using camel-core version 2.9.1.

I have an application that uses the File2 Camel Component. In cases of
write failures, my application intends to take the system error codes (,
and map it to an application level error code and send it to a client of my
application in a JMS response message.

I initially thought that the system error code would be reflected in the
facade exception GenericFileOperationFailedException. This doesn't appear
to be the case. Is this assertion correct?

So for example, if a directory doesn't have write permissions :

                from("file:/tmp/data?noop=true").process(new Processor() {
                    public void process(Exchange exchange) throws Exception
                        System.out.println("Shall attempt to write a sample
file to a directory with no write permission");

I have to dig into the GenericFileOperationFailedException to get the
FileNotFoundException, look for "Permission denied" in the
FileNotFoundException message, and if I find a match, then map to my
application-level error code. Somewhere in the exception chain the error
code provided by the OS is lost.

Any advice on how to best use GenericFileOperationFailedException in this
As a user it would be more preferable if I could use the getCode() on the
GenericFileOperationFailedException to reliably get the system error code,
when a system error is generated.
BRs //John.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message