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

FTP consumer sometimes throws NullPointerException

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.13.0
    • Fix Version/s: 2.12.4, 2.13.2, 2.14.0
    • Component/s: camel-ftp
    • Labels:
      None
    • Environment:

      Camel 2.13.1
      Oracle jdk 1.7.0_55
      Debian GNU/Linux oldstable
      Remote ftp server IIS on Windows 2000 server

    • Estimated Complexity:
      Unknown

      Description

      I have an exception from a ftp consumer only for few files.

      • It happens on few files (2 or 3). Remote directory contains many files
        (many thousand)
      • These few files have the same ownership and permissions of the others
        and are not empty
      • I stopped the application that create the files, to avoid any possible
        lock (anyway, I can modify them without problems)
      • I tried to copy and rename the files, removing the old one, (to create
        a completely new one) without success
      • Looking at the source code in
        FtpChangedExclusiveReadLockStrategy.java, the error happens getting the
        timestamp of the file:
        for (FTPFile f : files) {
            if (f.getName().equals(file.getFileNameOnly())) {
                newLastModified = f.getTimestamp().getTimeInMillis();
                newLength = f.getSize();
            }
        }
        
      • Nothing useful in the logs of the ftp server

      Follow a trace log and the exception regarding one of those files:

      2014-05-19 16:21:32,298 TRACE FtpChangedExclusiveReadLockStrategy -
      Waiting for exclusive read lock to file:
      RemoteFile[/dwrg1/moved/DWRG1_2014-03-30T01h30Z.xml]
      2014-05-19 16:21:32,298 TRACE FtpChangedExclusiveReadLockStrategy -
      Waiting for exclusive read lock to file:
      RemoteFile[/dwrg1/moved/DWRG1_2014-03-30T01h30Z.xml]
      2014-05-19 16:21:32,298 TRACE FtpChangedExclusiveReadLockStrategy -
      Waiting for exclusive read lock to file:
      RemoteFile[/dwrg1/moved/DWRG1_2014-03-30T01h30Z.xml]
      2014-05-19 16:21:32,299 TRACE FtpChangedExclusiveReadLockStrategy -
      Using fast exists to update file information for
      RemoteFile[/dwrg1/moved/DWRG1_2014-03-30T01h30Z.xml]
      2014-05-19 16:21:32,299 TRACE FtpChangedExclusiveReadLockStrategy -
      Using fast exists to update file information for
      RemoteFile[/dwrg1/moved/DWRG1_2014-03-30T01h30Z.xml]
      2014-05-19 16:21:32,640 TRACE FtpChangedExclusiveReadLockStrategy - List
      files /dwrg1/moved/DWRG1_2014-03-30T01h30Z.xml found 1 files
      2014-05-19 16:21:32,640 TRACE FtpChangedExclusiveReadLockStrategy - List
      files /dwrg1/moved/DWRG1_2014-03-30T01h30Z.xml found 1 files
      2014-05-19 16:21:32,650 WARN  FtpConsumer -
      Endpoint[ftp://xxxx@yy.yy.yy.yy//dwrg1/moved?delay=60000&disconnect=true&fastExistsCheck=true&idempotent=true&idempotentKey=%24%7Bfile%3Aname%7D-%24%7Bfile%3Amodified%7D-%24%7Bfile%3Asize%7D&idempotentRepository=%23fileStore&include=DWRG1.*%5C.xml&maxMessagesPerPoll=10&noop=true&password=xxxxxx&readLock=changed&sortBy=file%3Amodified] cannot begin processing file: RemoteFile[/dwrg1/moved/DWRG1_2014-03-30T01h30Z.xml] due to: null. Caused by: [java.lang.NullPointerException - null]
      java.lang.NullPointerException
              at
      org.apache.camel.component.file.remote.strategy.FtpChangedExclusiveReadLockStrategy.acquireExclusiveReadLock(FtpChangedExclusiveReadLockStrategy.java:83)
              at
      org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.begin(GenericFileProcessStrategySupport.java:49)
              at
      org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.begin(GenericFileRenameProcessStrategy.java:35)
              at
      org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:326)
              at
      org.apache.camel.component.file.remote.RemoteFileConsumer.processExchange(RemoteFileConsumer.java:99)
              at
      org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:201)
              at
      org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:165)
              at
      org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:187)
              at
      org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:114)
              at java.util.concurrent.Executors
      $RunnableAdapter.call(Executors.java:471)
              at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
              at java.util.concurrent.ScheduledThreadPoolExecutor
      $ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
              at java.util.concurrent.ScheduledThreadPoolExecutor
      $ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
              at
      java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
              at java.util.concurrent.ThreadPoolExecutor
      $Worker.run(ThreadPoolExecutor.java:615)
              at java.lang.Thread.run(Thread.java:745)
      

        Attachments

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              albertob Alberto Brosich
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: