Camel-File component FileUtil leaks FileInputStream when renameFile fails due to permission issue

Solution In Progress - Updated -

Issue

I have a simple camel route:

<camelContext xmlns="http://camel.apache.org/schema/spring">
    <route>
        <from uri="file:C:/tmp/data/in?include=.*$&amp;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.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content