Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
2.16.2
-
None
-
Unknown
Description
If I split a XML-file with xtokenize and streaming() in combination with a move-option on the file-consumer, I get an exception that the file cannot be moved. I assume that the stream is not closed or the file is otherwise still locked.
Simple example route:
from("file:data/xmltest?move=inProcessing/${file:name}")
.split().xtokenize("//order", new Namespaces("", "")).streaming()
.convertBodyTo(String.class)
.to("file:data/output?fileName=dummy.txt")
.end();
Error stacktrace:
2016-02-23 11:14:46 WARN GenericFileOnCompletion:136 - Error during commit. Exchange[ID-ZZZZZZZ-52905-1456222481032-0-2][order1.xml]. Caused by: [org.apache.camel.component.file.GenericFileOperationFailedException - Error renaming file from D:\data\xmltest\order1.xml to data\xmltest\inProcessing\order1.xml]
org.apache.camel.component.file.GenericFileOperationFailedException: Error renaming file from D:\data\xmltest\order1.xml to data\xmltest\inProcessing\order1.xml
at org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:81)
at org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.renameFile(GenericFileProcessStrategySupport.java:113)
at org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.commit(GenericFileRenameProcessStrategy.java:88)
at org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(GenericFileOnCompletion.java:127)
at org.apache.camel.component.file.GenericFileOnCompletion.onCompletion(GenericFileOnCompletion.java:83)
at org.apache.camel.component.file.GenericFileOnCompletion.onComplete(GenericFileOnCompletion.java:57)
at org.apache.camel.util.UnitOfWorkHelper.doneSynchronizations(UnitOfWorkHelper.java:104)
at org.apache.camel.impl.DefaultUnitOfWork.done(DefaultUnitOfWork.java:229)
at org.apache.camel.util.UnitOfWorkHelper.doneUow(UnitOfWorkHelper.java:65)
at org.apache.camel.processor.CamelInternalProcessor$UnitOfWorkProcessorAdvice.after(CamelInternalProcessor.java:653)
at org.apache.camel.processor.CamelInternalProcessor$UnitOfWorkProcessorAdvice.after(CamelInternalProcessor.java:608)
at org.apache.camel.processor.CamelInternalProcessor$InternalCallback.done(CamelInternalProcessor.java:239)
at org.apache.camel.processor.CamelInternalProcessor$InternalCallback.done(CamelInternalProcessor.java:250)
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:491)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:442)
at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:214)
at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:178)
at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174)
at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: Renaming file from 'D:\data\xmltest\order1.xml' to 'data\xmltest\inProcessing\order1.xml' failed: Cannot delete file 'D:\data\xmltest\order1.xml' after copy succeeded
at org.apache.camel.util.FileUtil.renameFileUsingCopy(FileUtil.java:510)
at org.apache.camel.util.FileUtil.renameFile(FileUtil.java:482)
at org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:78)
... 27 more