Author: davsclaus
Date: Sun Oct 2 06:58:19 2011
New Revision: 1178132
URL: http://svn.apache.org/viewvc?rev=1178132&view=rev
Log:
CAMEL-4505: Added option copyAndDeleteOnRenameFail to file component.
Modified:
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
Modified:
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java?rev=1178132&r1=1178131&r2=1178132&view=diff
==============================================================================
---
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java
(original)
+++
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java
Sun Oct 2 06:58:19 2011
@@ -430,8 +430,12 @@ public class FtpOperations implements Re
if (result) {
log.trace("Renaming local in progress file from: {} to: {}", temp,
local);
// operation went okay so rename temp to local after we have
retrieved the data
- if (!FileUtil.renameFile(temp, local)) {
- throw new GenericFileOperationFailedException("Cannot rename
local work file from: " + temp + " to: " + local);
+ try {
+ if (!FileUtil.renameFile(temp, local, false)) {
+ throw new GenericFileOperationFailedException("Cannot
rename local work file from: " + temp + " to: " + local);
+ }
+ } catch (IOException e) {
+ throw new GenericFileOperationFailedException("Cannot rename
local work file from: " + temp + " to: " + local, e);
}
}
Modified:
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java?rev=1178132&r1=1178131&r2=1178132&view=diff
==============================================================================
---
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
(original)
+++
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
Sun Oct 2 06:58:19 2011
@@ -589,8 +589,12 @@ public class SftpOperations implements R
// operation went okay so rename temp to local after we have retrieved
the data
LOG.trace("Renaming local in progress file from: {} to: {}", temp,
local);
- if (!FileUtil.renameFile(temp, local)) {
- throw new GenericFileOperationFailedException("Cannot rename local
work file from: " + temp + " to: " + local);
+ try {
+ if (!FileUtil.renameFile(temp, local, false)) {
+ throw new GenericFileOperationFailedException("Cannot rename
local work file from: " + temp + " to: " + local);
+ }
+ } catch (IOException e) {
+ throw new GenericFileOperationFailedException("Cannot rename local
work file from: " + temp + " to: " + local, e);
}
return true;