This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

AnnouncementAnnouncement Module

Collapse

No announcement yet.

sftp:outbound-channel-adapter locks a file if exception occurs during writingPage Title Module

sftp:outbound-channel-adapter locks a file if exception occurs during writing

Jun 8th, 2011, 08:46 AM

I think I found a bug in method sendFileToRemoteDirectory in class org.springframework.integration.file.remote.handle r.FileTransferringMessageHandler. The problem occurs when session.write fails and fileInputStream is not closed. The file is locked. This becomes a problem when you have strategy for error handing based on moving this file to error or delay folder using file:outbound-channel-adapter with delete-source-files="true". You can't do that because the file is locked. The solution is easy: put fileInputStream.close() in finally block. Here is my integration-context (if remote-directory in sftp:outbound-channel-adapter does not exist, my file is not moved to delay1 folder):