Camel-File component FileUtil leaks FileInputStream when renameFile fails due to permission issue
Issue
I have a simple camel route:
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="file:C:/tmp/data/in?include=.*$&move=C:/tmp/data/done/${file:onlyname}-${exchangeId}" />
<setHeader headerName="CamelFileName">
<simple>${file:onlyname}-${exchangeId}</simple>
</setHeader>
<to uri="file:C:/tmp/data/out" />
</route>
</camelContext>
If the destination folder "C:/tmp/data/done/" for the move operation does not allow writing, then the file dropped to the "C:/tmp/data/in/" folder will be repeatedly polled, processed and rolled back due to "Access is denied" exception.
Even if we fix the permission issue on the folder "C:/tmp/data/done/" to allow writing, the problem still persists and above endless cycle continues. However the reason for the issue will be a bit different now. It is caused by deletion failure to the file from "C:/tmp/data/in/" folder after successful FileUtil.renameFile() operation due to fact that something is still holding the file handle.
Environment
- JBoss Fuse 6.1
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.