camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [3/3] camel git commit: CAMEL-10185: readLock=change and fastExistsCheck=true issue.
Date Fri, 05 Aug 2016 05:54:13 GMT
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/253d412b
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/253d412b
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/253d412b

Branch: refs/heads/camel-2.16.x
Commit: 253d412b5a43e1415f31100b901d0966b923e464
Parents: 52e46f4
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Fri Aug 5 07:53:17 2016 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Fri Aug 5 07:53:59 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/253d412b/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/253d412b/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();
                 }


Mime
View raw message