You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/08/05 05:54:12 UTC

[2/3] camel git commit: CAMEL-10185: readLock=change and fastExistsCheck=true issue.

CAMEL-10185: readLock=change and fastExistsCheck=true issue.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/15c236b9
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/15c236b9
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/15c236b9

Branch: refs/heads/camel-2.17.x
Commit: 15c236b9964db70bf2453b8f5bc45b67b134f99b
Parents: 1880db6
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Aug 5 07:53:17 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Aug 5 07:53:42 2016 +0200

----------------------------------------------------------------------
 .../strategy/FtpChangedExclusiveReadLockStrategy.java       | 9 ++++++++-
 .../strategy/SftpChangedExclusiveReadLockStrategy.java      | 9 ++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/15c236b9/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/FtpChangedExclusiveReadLockStrategy.java
----------------------------------------------------------------------
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/FtpChangedExclusiveReadLockStrategy.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/FtpChangedExclusiveReadLockStrategy.java
index a1db2bb..ba9093d 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/FtpChangedExclusiveReadLockStrategy.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/FtpChangedExclusiveReadLockStrategy.java
@@ -83,7 +83,14 @@ public class FtpChangedExclusiveReadLockStrategy implements GenericFileExclusive
             }
             LOG.trace("List files {} found {} files", file.getAbsoluteFilePath(), files.size());
             for (FTPFile f : files) {
-                if (f.getName().equals(file.getFileNameOnly())) {
+                boolean match;
+                if (fastExistsCheck) {
+                    // uses the absolute file path as well
+                    match = f.getName().equals(file.getAbsoluteFilePath()) || f.getName().equals(file.getFileNameOnly());
+                } else {
+                    match = f.getName().equals(file.getFileNameOnly());
+                }
+                if (match) {
                     newLength = f.getSize();
                     if (f.getTimestamp() != null) {
                         newLastModified = f.getTimestamp().getTimeInMillis();

http://git-wip-us.apache.org/repos/asf/camel/blob/15c236b9/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/SftpChangedExclusiveReadLockStrategy.java
----------------------------------------------------------------------
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/SftpChangedExclusiveReadLockStrategy.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/SftpChangedExclusiveReadLockStrategy.java
index 165f1bb..7ac91c1 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/SftpChangedExclusiveReadLockStrategy.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/SftpChangedExclusiveReadLockStrategy.java
@@ -82,7 +82,14 @@ public class SftpChangedExclusiveReadLockStrategy implements GenericFileExclusiv
             }
             LOG.trace("List files {} found {} files", file.getAbsoluteFilePath(), files.size());
             for (ChannelSftp.LsEntry f : files) {
-                if (f.getFilename().equals(file.getFileNameOnly())) {
+                boolean match;
+                if (fastExistsCheck) {
+                    // uses the absolute file path as well
+                    match = f.getFilename().equals(file.getAbsoluteFilePath()) || f.getFilename().equals(file.getFileNameOnly());
+                } else {
+                    match = f.getFilename().equals(file.getFileNameOnly());
+                }
+                if (match) {
                     newLastModified = f.getAttrs().getMTime() * 1000;
                     newLength = f.getAttrs().getSize();
                 }