Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-13400

Camel FTP Cannot list directory with 'File not found' prepending additional '/' in front of directory automatically

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.0.0-M1
    • 2.23.3, 2.22.5, 2.24.1, 3.0.0
    • camel-ftp
    • None
    • Unknown

    Description

      I need to poll files form a dynamic folder based on a specific date, so I have provided the parent directory in endpoint URI, enabled recursive flag and add filterDirectory accordingly. But It is not able to poll from the directory, it says file not found for that directory. It is trying with an addition '/' while listing listFor(/XXXX)

      Endpoint URI

      {{sftp://XXXX:22051?connectTimeout=90000&disconnect=true&filterDirectory=%24%7Bfile%3Aname%7D+starts+with+%27%24%7Bbean%3AdateofExchange%3Fmethod%3DforLoc%28%22MY%22%29%7D%27&flatten=true&include=.IMG&knownHostsFile=C%3A%5Cprogram+files%5Cascertain%5CI2R-MystiQ-Engine%5Cknown_hosts&noop=true&password=xxxxxx&preferredAuthentications=password&reconnectDelay=30000&recursive=true&scheduler=quartz2&scheduler.cron=0+0%2F5++%3F&stepwise=false&username=XXXX_ftpuser }}

      TRACE LOG

      {{TRACE 2019-04-05T15:25:03,389 [org.apache.camel.component.file.remote.SftpConsumer] - Polling directory: TRACE 2019-04-05T15:25:03,389 [org.apache.camel.component.file.remote.SftpOperations] - listFiles() TRACE 2019-04-05T15:25:03,712 [org.apache.camel.component.file.remote.SftpConsumer] - Found 12 in directory: TRACE 2019-04-05T15:25:03,712 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=., longName=dr-x------ 2 ftpadmin ftpadmin 0 Mar 12 05:27 ., dir=true] TRACE 2019-04-05T15:25:03,712 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[.] TRACE 2019-04-05T15:25:03,712 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=.., longName=dr-x------ 2 ftpadmin ftpadmin 0 Mar 12 03:04 .., dir=true] TRACE 2019-04-05T15:25:03,712 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[..] TRACE 2019-04-05T15:25:03,728 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=20170526, longName=dr-x------ 2 ftpadmin ftpadmin 0 Mar 12 02:16 20170526, dir=true] TRACE 2019-04-05T15:25:04,413 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[20170526] TRACE 2019-04-05T15:25:04,413 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=20181119, longName=dr-x------ 2 ftpadmin ftpadmin 0 Mar 12 05:24 20181119, dir=true] TRACE 2019-04-05T15:25:05,117 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[20181119] TRACE 2019-04-05T15:25:05,117 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=20181121, longName=dr-x------ 2 ftpadmin ftpadmin 0 Mar 12 05:25 20181121, dir=true] TRACE 2019-04-05T15:25:05,837 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[20181121] TRACE 2019-04-05T15:25:05,840 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=20181122, longName=dr-x------ 2 ftpadmin ftpadmin 0 Mar 12 05:26 20181122, dir=true] TRACE 2019-04-05T15:25:06,561 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[20181122] TRACE 2019-04-05T15:25:06,563 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=20181123, longName=dr-x------ 2 ftpadmin ftpadmin 0 Mar 12 05:27 20181123, dir=true] TRACE 2019-04-05T15:25:07,258 [org.apache.camel.component.file.remote.SftpConsumer] - Polling sub directory: /20181123 from: sftp://XXXX:22051?connectTimeout=90000&disconnect=true&filterDirectory=%24%7Bfile%3Aname%7D+starts+with+%27%24%7Bbean%3AdateofExchange%3Fmethod%3DforLoc%28%22MY%22%29%7D%27&flatten=true&include=.IMG&knownHostsFile=C%3A%5Cprogram+files%5Cascertain%5CI2R-MystiQ-Engine%5Cknown_hosts&noop=true&password=xxxxxx&preferredAuthentications=password&reconnectDelay=30000&recursive=true&scheduler=quartz2&scheduler.cron=0+0%2F5+%3F&stepwise=false&username=XXXX_ftpuser TRACE 2019-04-05T15:25:07,260 [org.apache.camel.component.file.remote.SftpConsumer] - doPollDirectory from absolutePath: /20181123, dirName: 20181123 TRACE 2019-04-05T15:25:07,263 [org.apache.camel.component.file.remote.SftpConsumer] - Polling directory: /20181123 TRACE 2019-04-05T15:25:07,265 [org.apache.camel.component.file.remote.SftpOperations] - listFiles(/20181123) DEBUG 2019-04-05T15:25:07,281 [org.apache.camel.component.file.remote.SftpConsumer] - Caught exception Cannot list directory: /20181123 TRACE 2019-04-05T15:25:07,297 [org.apache.camel.component.file.remote.SftpConsumer] - Not ignoring file error Cannot list directory: /20181123 for /20181123 DEBUG 2019-04-05T15:25:07,297 [org.apache.camel.component.file.remote.SftpConsumer] - Error occurred during poll directory: due Cannot list directory: /20181123. Removing 0 files marked as in-progress. WARN 2019-04-05T15:25:07,297 [org.apache.camel.component.file.remote.RemoteFilePollingConsumerPollStrategy] - Trying to recover by force disconnecting from remote server and re-connecting at next poll: sftp://XXX@1XXXX:22051 DEBUG 2019-04-05T15:25:07,297 [org.apache.camel.component.file.remote.SftpConsumer] - Force disconnecting from: sftp://XXX@XXXX:22051 WARN 2019-04-05T15:25:07,297 [org.apache.camel.component.file.remote.SftpConsumer] - Consumer SftpConsumer[sftp://XXXX:22051?connectTimeout=90000&disconnect=true&filterDirectory=%24%7Bfile%3Aname%7D+starts+with+%27%24%7Bbean%3AdateofExchange%3Fmethod%3DforLoc%28%22MY%22%29%7D%27&flatten=true&include=.*IMG&knownHostsFile=C%3A%5Cprogram+files%5Cascertain%5CI2R-MystiQ-Engine%5Cknown_hosts&noop=true&password=xxxxxx&preferredAuthentications=password&reconnectDelay=30000&recursive=true&scheduler=quartz2&scheduler.cron=0+0%2F5+*+*+*+%3F&stepwise=false&username=XXXX_ftpuser] failed polling endpoint: sftp://XXXX:22051?connectTimeout=90000&disconnect=true&filterDirectory=%24%7Bfile%3Aname%7D+starts+with%27%24%7Bbean%3AdateofExchange%3Fmethod%3DforLoc%28%22MY%22%29%7D%27&flatten=true&include=.IMG&knownHostsFile=C%3A%5Cprogram+files%5Cascertain%5CI2R-MystiQ-Engine%5Cknown_hosts&noop=true&password=xxxxxx&preferredAuthentications=password&reconnectDelay=30000&recursive=true&scheduler=quartz2&scheduler.cron=0+0%2F5++%3F&stepwise=false&username=XXXX_ftpuser. Will try again at next poll. Caused by: [org.apache.camel.component.file.GenericFileOperationFailedException - Cannot list directory: /20181123] org.apache.camel.component.file.GenericFileOperationFailedException: Cannot list directory: /20181123 at org.apache.camel.component.file.remote.SftpOperations.listFiles(SftpOperations.java:660) ~[camel-ftp-2.21.1.jar!/:2.21.1] at org.apache.camel.component.file.remote.SftpConsumer.doPollDirectory(SftpConsumer.java:128) ~[camel-ftp-2.21.1.jar!/:2.21.1] at org.apache.camel.component.file.remote.RemoteFileConsumer.doSafePollSubDirectory(RemoteFileConsumer.java:260) ~[camel-ftp-2.21.1.jar!/:2.21.1] at org.apache.camel.component.file.remote.SftpConsumer.pollSubDirectory(SftpConsumer.java:96) ~[camel-ftp-2.21.1.jar!/:2.21.1] at org.apache.camel.component.file.remote.SftpConsumer.doPollDirectory(SftpConsumer.java:178) ~[camel-ftp-2.21.1.jar!/:2.21.1] at org.apache.camel.component.file.remote.SftpConsumer.pollDirectory(SftpConsumer.java:87) ~[camel-ftp-2.21.1.jar!/:2.21.1] at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:124) ~[camel-core-2.21.1.jar!/:2.21.1] at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174) [camel-core-2.21.1.jar!/:2.21.1] at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101) [camel-core-2.21.1.jar!/:2.21.1] at org.apache.camel.pollconsumer.quartz2.QuartzScheduledPollConsumerJob.execute(QuartzScheduledPollConsumerJob.java:61) [camel-quartz2-2.21.1.jar!/:2.21.1] at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [quartz-2.3.0.jar!/:?] at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [quartz-2.3.0.jar!/:?] Caused by: com.jcraft.jsch.SftpException: File not found: /20181123 at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2873) ~[jsch-0.1.54.jar!/:?] at com.jcraft.jsch.ChannelSftp._stat(ChannelSftp.java:2225) ~[jsch-0.1.54.jar!/:?] at com.jcraft.jsch.ChannelSftp._stat(ChannelSftp.java:2242) ~[jsch-0.1.54.jar!/:?] at com.jcraft.jsch.ChannelSftp.ls(ChannelSftp.java:1592) ~[jsch-0.1.54.jar!/:?] at com.jcraft.jsch.ChannelSftp.ls(ChannelSftp.java:1553) ~[jsch-0.1.54.jar!/:?] at org.apache.camel.component.file.remote.SftpOperations.listFiles(SftpOperations.java:651) ~[camel-ftp-2.21.1.jar!/:2.21.1] ... 11 more }}

      When I try to hardcode that folder along with endpint URI, it simply can list that directory and poll files. This time there is no '/' before the directory while listing listFor(XXXX)

      Endpoint URI

      {{sftp://XXXX:22051/20181123?connectTimeout=90000&disconnect=true&flatten=true&include=.IMG&knownHostsFile=C%3A%5Cprogram+files%5Cascertain%5CI2R-MystiQ-Engine%5Cknown_hosts&noop=true&password=xxxxxx&preferredAuthentications=password&reconnectDelay=30000&recursive=true&scheduler=quartz2&scheduler.cron=0+0%2F5++%3F&separator=Auto&stepwise=false&username=XXXX_ftpuser }}

      TRACE LOG

      {{TRACE 2019-04-05T18:40:00,009 [org.apache.camel.component.file.remote.SftpConsumer] - prePollCheck on sftp://XXX@XXXX:22051 DEBUG 2019-04-05T18:40:00,009 [org.apache.camel.component.file.remote.SftpConsumer] - Not connected/logged in, connecting to: sftp://XXX@XXXX:22051 TRACE 2019-04-05T18:40:00,009 [org.apache.camel.component.file.remote.SftpOperations] - Session isn't connected, trying to recreate and connect. DEBUG 2019-04-05T18:40:00,009 [org.apache.camel.component.file.remote.SftpOperations] - Using knownhosts file: C:\program files\ascertain\I2R-MystiQ-Engine\known_hosts DEBUG 2019-04-05T18:40:00,009 [org.apache.camel.component.file.remote.SftpOperations] - Using known hosts information from file: C:\program files\ascertain\I2R-MystiQ-Engine\known_hosts DEBUG 2019-04-05T18:40:00,025 [org.apache.camel.component.file.remote.SftpOperations] - Using StrickHostKeyChecking: no DEBUG 2019-04-05T18:40:00,025 [org.apache.camel.component.file.remote.SftpOperations] - Using PreferredAuthentications: password TRACE 2019-04-05T18:40:00,025 [org.apache.camel.component.file.remote.SftpOperations] - Connecting use connectTimeout: 90000 ... TRACE 2019-04-05T18:40:00,465 [org.apache.camel.component.file.remote.SftpOperations] - Channel isn't connected, trying to recreate and connect. TRACE 2019-04-05T18:40:00,465 [org.apache.camel.component.file.remote.SftpOperations] - Connecting use connectTimeout: 90000 ... DEBUG 2019-04-05T18:40:01,215 [org.apache.camel.component.file.remote.SftpOperations] - Connected to sftp://XXX@XXXX:22051 DEBUG 2019-04-05T18:40:01,215 [org.apache.camel.component.file.remote.SftpConsumer] - Connected and logged in to: sftp://XXX@XXXX:22051 TRACE 2019-04-05T18:40:01,215 [org.apache.camel.component.file.remote.SftpConsumer] - doPollDirectory from absolutePath: 20181123, dirName: null TRACE 2019-04-05T18:40:01,215 [org.apache.camel.component.file.remote.SftpConsumer] - Polling directory: 20181123 TRACE 2019-04-05T18:40:01,215 [org.apache.camel.component.file.remote.SftpOperations] - listFiles(20181123) TRACE 2019-04-05T18:40:02,621 [org.apache.camel.component.file.remote.SftpConsumer] - Found 6 in directory: 20181123 TRACE 2019-04-05T18:40:02,621 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=., longName=dr-x------ 2 ftpadmin ftpadmin 0 Mar 12 05:27 ., dir=true] TRACE 2019-04-05T18:40:02,621 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[.] TRACE 2019-04-05T18:40:02,637 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=.., longName=dr-x------ 2 ftpadmin ftpadmin 0 Mar 12 05:27 .., dir=true] TRACE 2019-04-05T18:40:02,637 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[..] TRACE 2019-04-05T18:40:02,637 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=Consolidated, longName=dr-x------ 2 ftpadmin ftpadmin 0 Mar 12 05:26 Consolidated, dir=true] TRACE 2019-04-05T18:40:02,637 [org.apache.camel.component.file.remote.SftpConsumer] - Polling sub directory: 20181123/Consolidated from: sftp://XXXX:22051/20181123?connectTimeout=90000&disconnect=true&flatten=true&include=.IMG&knownHostsFile=C%3A%5Cprogram+files%5Cascertain%5CI2R-MystiQ-Engine%5Cknown_hosts&noop=true&password=xxxxxx&preferredAuthentications=password&reconnectDelay=30000&recursive=true&scheduler=quartz2&scheduler.cron=0+0%2F5+%3F&separator=Auto&stepwise=false&username=XXXX_ftpuser TRACE 2019-04-05T18:40:02,637 [org.apache.camel.component.file.remote.SftpConsumer] - doPollDirectory from absolutePath: 20181123/Consolidated, dirName: Consolidated TRACE 2019-04-05T18:40:02,637 [org.apache.camel.component.file.remote.SftpConsumer] - Polling directory: 20181123/Consolidated TRACE 2019-04-05T18:40:02,637 [org.apache.camel.component.file.remote.SftpOperations] - listFiles(20181123/Consolidated) TRACE 2019-04-05T18:40:02,715 [org.apache.camel.component.file.remote.SftpConsumer] - Found 5 in directory: 20181123/Consolidated TRACE 2019-04-05T18:40:02,715 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=., longName=dr-x------ 2 ftpadmin ftpadmin 0 Mar 12 05:26 ., dir=true] TRACE 2019-04-05T18:40:02,715 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[Consolidated/.] TRACE 2019-04-05T18:40:02,715 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=.., longName=dr-x------ 2 ftpadmin ftpadmin 0 Mar 12 05:27 .., dir=true] TRACE 2019-04-05T18:40:02,715 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[Consolidated/..] TRACE 2019-04-05T18:40:02,715 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=20181124020438943_021420181123INW.MYR, longName=-r-x------ 1 ftpadmin ftpadmin 408097 Nov 23 2018 20181124020438943_021420181123INW.MYR, dir=false] TRACE 2019-04-05T18:40:02,731 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[Consolidated/20181124020438943_021420181123INW.MYR] TRACE 2019-04-05T18:40:02,731 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=20181124020439099_035820181123INW.MYR, longName=-r-x------ 1 ftpadmin ftpadmin 21689 Nov 23 2018 20181124020439099_035820181123INW.MYR, dir=false] TRACE 2019-04-05T18:40:02,731 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[Consolidated/20181124020439099_035820181123INW.MYR] TRACE 2019-04-05T18:40:02,731 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=ToPPay, longName=dr-x------ 2 ftpadmin ftpadmin 0 Mar 12 06:41 ToPPay, dir=true] TRACE 2019-04-05T18:40:02,731 [org.apache.camel.component.file.remote.SftpConsumer] - Polling sub directory: 20181123/Consolidated/ToPPay from: sftp://XXXX:22051/20181123?connectTimeout=90000&disconnect=true&flatten=true&include=.IMG&knownHostsFile=C%3A%5Cprogram+files%5Cascertain%5CI2R-MystiQ-Engine%5Cknown_hosts&noop=true&password=xxxxxx&preferredAuthentications=password&reconnectDelay=30000&recursive=true&scheduler=quartz2&scheduler.cron=0+0%2F5%3F&separator=Auto&stepwise=false&username=XXXX_ftpuser TRACE 2019-04-05T18:40:02,731 [org.apache.camel.component.file.remote.SftpConsumer] - doPollDirectory from absolutePath: 20181123/Consolidated/ToPPay, dirName: ToPPay TRACE 2019-04-05T18:40:02,731 [org.apache.camel.component.file.remote.SftpConsumer] - Polling directory: 20181123/Consolidated/ToPPay TRACE 2019-04-05T18:40:02,731 [org.apache.camel.component.file.remote.SftpOperations] - listFiles(20181123/Consolidated/ToPPay) TRACE 2019-04-05T18:40:02,777 [org.apache.camel.component.file.remote.SftpConsumer] - Found 8 in directory: 20181123/Consolidated/ToPPay TRACE 2019-04-05T18:40:02,777 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=., longName=dr-x------ 2 ftpadmin ftpadmin 0 Mar 12 06:41 ., dir=true] TRACE 2019-04-05T18:40:02,777 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[Consolidated/ToPPay/.] TRACE 2019-04-05T18:40:02,777 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=.., longName=dr-x------ 2 ftpadmin ftpadmin 0 Mar 12 05:26 .., dir=true] TRACE 2019-04-05T18:40:02,777 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[Consolidated/ToPPay/..] TRACE 2019-04-05T18:40:02,793 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=021420181123INW.MYR, longName=-r-x------ 1 ftpadmin ftpadmin 408097 Nov 23 2018 021420181123INW.MYR, dir=false] TRACE 2019-04-05T18:40:02,793 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[Consolidated/ToPPay/021420181123INW.MYR] TRACE 2019-04-05T18:40:02,793 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=021420181123INW1.MYR, longName=-r-x------ 1 ftpadmin ftpadmin 579829 Nov 23 2018 021420181123INW1.MYR, dir=false] TRACE 2019-04-05T18:40:02,793 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[Consolidated/ToPPay/021420181123INW1.MYR] TRACE 2019-04-05T18:40:02,793 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=035820181123INW.MYR, longName=-r-x------ 1 ftpadmin ftpadmin 21689 Nov 23 2018 035820181123INW.MYR, dir=false] TRACE 2019-04-05T18:40:02,793 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[Consolidated/ToPPay/035820181123INW.MYR] TRACE 2019-04-05T18:40:02,793 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=035820181123INW1.MYR, longName=-r-x------ 1 ftpadmin ftpadmin 30954 Nov 23 2018 035820181123INW1.MYR, dir=false] TRACE 2019-04-05T18:40:02,793 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[Consolidated/ToPPay/035820181123INW1.MYR] TRACE 2019-04-05T18:40:02,809 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=20181124020438943_021420181123INW.MYR, longName=-r-x------ 1 ftpadmin ftpadmin 408097 Nov 23 2018 20181124020438943_021420181123INW.MYR, dir=false] TRACE 2019-04-05T18:40:02,809 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[Consolidated/ToPPay/20181124020438943_021420181123INW.MYR] TRACE 2019-04-05T18:40:02,809 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=20181124020439099_035820181123INW.MYR, longName=-r-x------ 1 ftpadmin ftpadmin 21689 Nov 23 2018 20181124020439099_035820181123INW.MYR, dir=false] TRACE 2019-04-05T18:40:02,809 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[Consolidated/ToPPay/20181124020439099_035820181123INW.MYR] TRACE 2019-04-05T18:40:02,809 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=Data, longName=dr-x------ 2 ftpadmin ftpadmin 0 Mar 12 05:26 Data, dir=true] TRACE 2019-04-05T18:40:02,809 [org.apache.camel.component.file.remote.SftpConsumer] - Polling sub directory: 20181123/Data from: sftp://XXXX:22051/20181123?connectTimeout=90000&disconnect=true&flatten=true&include=.IMG&knownHostsFile=C%3A%5Cprogram+files%5Cascertain%5CI2R-MystiQ-Engine%5Cknown_hosts&noop=true&password=xxxxxx&preferredAuthentications=password&reconnectDelay=30000&recursive=true&scheduler=quartz2&scheduler.cron=0+0%2F5+%3F&separator=Auto&stepwise=false&username=XXXX_ftpuser TRACE 2019-04-05T18:40:02,809 [org.apache.camel.component.file.remote.SftpConsumer] - doPollDirectory from absolutePath: 20181123/Data, dirName: Data TRACE 2019-04-05T18:40:02,809 [org.apache.camel.component.file.remote.SftpConsumer] - Polling directory: 20181123/Data TRACE 2019-04-05T18:40:02,809 [org.apache.camel.component.file.remote.SftpOperations] - listFiles(20181123/Data) TRACE 2019-04-05T18:40:02,871 [org.apache.camel.component.file.remote.SftpConsumer] - Found 501 in directory: 20181123/Data TRACE 2019-04-05T18:40:02,871 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=., longName=dr-x------ 2 ftpadmin ftpadmin 0 Mar 12 05:26 ., dir=true] TRACE 2019-04-05T18:40:02,871 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[Data/.] TRACE 2019-04-05T18:40:02,871 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=.., longName=dr-x------ 2 ftpadmin ftpadmin 0 Mar 12 05:27 .., dir=true] TRACE 2019-04-05T18:40:02,871 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[Data/..] TRACE 2019-04-05T18:40:02,871 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=20181123021401015101004323IWNM.MMYR, longName=-r-x------ 1 ftpadmin ftpadmin 14846 Nov 23 2018 20181123021401015101004323IWNM.MMYR, dir=false] TRACE 2019-04-05T18:40:02,871 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[Data/20181123021401015101004323IWNM.MMYR] }}

      I am sure that the cause of the issue has to be the addition '/' prepending with directory name while listing listFor(/XXXX). How can I avoid it ! .. using seperator parameter didn't effect i suppose it is only for producing files and not for consuming. I need to resolve this issue as soon as possible. Please suggest me some solution

      EDITED :

      I can reproduce the issue in latest version as well,I suppose the issue is when there is no base path only the '/' gets prepended which should not actually happen

      Code Snippet from SftpConsumer.java Camel 3.0.0.M1

      {{if (file.isDirectory()) { RemoteFile<SftpRemoteFile> remote = asRemoteFile(absolutePath, file, getEndpoint().getCharset()); if (endpoint.isRecursive() && depth < endpoint.getMaxDepth() && isValidFile(remote, true, files)) { // recursive scan and add the sub files and folders String subDirectory = file.getFilename(); String path = absolutePath + "/" + subDirectory; boolean canPollMore = pollSubDirectory(path, subDirectory, fileList, depth); if (!canPollMore)

      { return false; }

      } // we cannot use file.getAttrs().isLink on Windows, so we dont invoke the method // just assuming its a file we should poll } }}

      String path = absolutePath + "/" + subDirectory;

      Attachments

        Issue Links

          Activity

            People

              davsclaus Claus Ibsen
              vsvdhsagar Vidhya Sagar Jeevendran
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m