[jcifs] "Could not delete file" warning when moving
I have another issue with the "could not delete" warning.
If the GenericFileProcessStrategySupport is going to rename file A to B, it tries to delete B before.
But if B does not exist (which is default, because we want to rename A to B), the DefaultSmbClient logs the warning message.
This is quite annoying, because so we get a lot of false warning messages (we are processing thousand of files each hour).
Till I don't have a good idea, how to solve this issue.
Perhaps the the GenericFileProcessStrategySupport should not try to delete the file, because the GenericFileOperations interface has its own renameFile (which is used after deleting), where the concrete implementation should ensure that the target file is deleted before (as camel-jcifs does). But this would be an issue for the camle-core team. (Edit: and it would also change existing behavior)
Another solution could be to pass a suppressWarnings flag to the delete operation, but imo this is also quite ugly.
One solution could be just to check if the target file exists, before deleting. This could be done in DefaultSmbClient OR in GenericFileOperations
Re: [jcifs] "Could not delete file" warning when moving
No there will not be that much overhead due to the way jcifs API work internally.
Right now the call to smbFile.delete() will fetch file attributes before issue the delete command.
However if we add the call to smbFile.exists() it will fetch the file attributes and cache them.
The subsequent call to smbFile.delete() will then just use the cached attributes.