Author: davsclaus
Date: Sun Nov 1 13:36:53 2009
New Revision: 831675
URL: http://svn.apache.org/viewvc?rev=831675&view=rev
Log:
Added a little more logging when downloading ftp to local work dir.
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=831675&r1=831674&r2=831675&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 Nov 1 13:36:53 2009
@@ -305,16 +305,25 @@
target.setBody(local);
result = client.retrieveFile(name, os);
- } catch (IOException e) {
+ } catch (IOException e) {
throw new
GenericFileOperationFailedException(client.getReplyCode(),
client.getReplyString(), e.getMessage(), e);
} finally {
// need to close the stream before rename it
ObjectHelper.close(os, "retrieve: " + name, LOG);
}
- // 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);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Retrieve file to local work file result: " + result);
+ }
+
+ if (result) {
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Renaming local in progress file from: " + temp + "
to: " + 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);
+ }
}
return result;
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=831675&r1=831674&r2=831675&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 Nov 1 13:36:53 2009
@@ -370,21 +370,29 @@
throw new GenericFileOperationFailedException("Cannot create new
local work file: " + local);
}
+
try {
// store the java.io.File handle as the body
file.setBody(local);
channel.get(name, os);
-
- // 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);
- }
} catch (SftpException e) {
throw new GenericFileOperationFailedException("Cannot retrieve
file: " + name, e);
} finally {
ObjectHelper.close(os, "retrieve: " + name, LOG);
}
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Retrieve file to local work file result: true");
+ }
+
+ // operation went okay so rename temp to local after we have retrieved
the data
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Renaming local in progress file from: " + temp + " to:
" + local);
+ }
+ if (!FileUtil.renameFile(temp, local)) {
+ throw new GenericFileOperationFailedException("Cannot rename local
work file from: " + temp + " to: " + local);
+ }
+
return true;
}