Hi again,
Sorry not coming with a full compiled test case, but i've looked at the source code in the spring-integration-file package, and i think the problem may come from that the rename function is not working, but its return value is not processed here :
What about deleting src file first and then renaming the tempFile, if first rename failed (returned false) ?Code:private File handleFileMessage(File sourceFile, File tempFile, File resultFile) throws IOException {
if (this.deleteSourceFiles) {
if (sourceFile.renameTo(resultFile)) {
return resultFile;
}
if (logger.isInfoEnabled()) {
logger.info(String.format("Failed to move file '%s'. Using copy and delete fallback.",
sourceFile.getAbsolutePath()));
}
}
FileCopyUtils.copy(sourceFile, tempFile);
tempFile.renameTo(resultFile);
if (this.deleteSourceFiles) {
sourceFile.delete();
}
return resultFile;
}
private File handleByteArrayMessage(byte[] bytes, File originalFile, File tempFile, File resultFile) throws IOException {
FileCopyUtils.copy(bytes, tempFile);
tempFile.renameTo(resultFile);
if (this.deleteSourceFiles && originalFile != null) {
originalFile.delete();
}
return resultFile;
}
private File handleStringMessage(String content, File originalFile, File tempFile, File resultFile) throws IOException {
OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(tempFile), this.charset);
FileCopyUtils.copy(content, writer);
tempFile.renameTo(resultFile);
if (this.deleteSourceFiles && originalFile != null) {
originalFile.delete();
}
return resultFile;
}
Thanks for your help
Max
