Author: davsclaus
Date: Tue Oct 23 12:22:16 2012
New Revision: 1401266
URL: http://svn.apache.org/viewvc?rev=1401266&view=rev
Log:
CAMEL-5737: Fixed issue with localWorkDirectory option on camel-ftp.
Added:
camel/branches/camel-2.10.x/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerLocalWorkDirectoryDirectTest.java
- copied unchanged from r1401264,
camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerLocalWorkDirectoryDirectTest.java
Modified:
camel/branches/camel-2.10.x/ (props changed)
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/file/FileOperations.java
Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Merged /camel/trunk:r1401264
Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/file/FileOperations.java
URL:
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/file/FileOperations.java?rev=1401266&r1=1401265&r2=1401266&view=diff
==============================================================================
---
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/file/FileOperations.java
(original)
+++
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/file/FileOperations.java
Tue Oct 23 12:22:16 2012
@@ -201,19 +201,21 @@ public class FileOperations implements G
// we can optimize and use file based if no charset must be used,
and the input body is a file
File source = null;
+ boolean fileBased = false;
if (charset == null) {
// if no charset, then we can try using file directly
(optimized)
Object body = exchange.getIn().getBody();
if (body instanceof WrappedFile) {
body = ((WrappedFile<?>) body).getFile();
+ fileBased = true;
}
if (body instanceof File) {
source = (File) body;
}
}
- if (source != null) {
- // okay we know the body is a file type
+ if (fileBased) {
+ // okay we know the body is a file based
// so try to see if we can optimize by renaming the local work
path file instead of doing
// a full file to file copy, as the local work copy is to be
deleted afterwards anyway
@@ -230,7 +232,7 @@ public class FileOperations implements G
// to the target.
return true;
}
- } else if (source.exists()) {
+ } else if (source != null && source.exists()) {
// no there is no local work file so use file to file copy
if the source exists
writeFileByFile(source, file);
// try to keep last modified timestamp if configured to do
so