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

FileIdempotentRepository fails to create fileStore when no path is specified

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 2.16.0
    • 2.15.6, 2.16.2, 2.17.0
    • camel-core
    • None
    • Novice

    Description

      I create a FileIdempotentRepository like this:

      .idempotentConsumer(fileIdempotentRepository(new File('ids'))) {
          it.in.body.id
      }
      

      I get an error, and I traced it to:

      Caused by: java.lang.NullPointerException: null
      	at org.apache.camel.processor.idempotent.mpotentRepository.loadStore(FileIdempotentRepository.java:293) ~[camel-core-2.16.0.jar:2.16.0]
      	at org.apache.camel.processor.idempotent.FileIdempotentRepository.doStart(FileIdempotentRepository.java:328) ~[camel-core-2.16.0.jar:2.16.0]
      

      The FileIdempotentRepository is trying to create the parent directory of the file that was specified for the file store. If a path to the file is not specified, then getParentFile() returns null. Calling .mkdirs() on that bombs.

      This route works the second time it runs because then the file exists. It also works if I specify my file name as "./ids" instead of "ids".

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            kgeis Ken Geis
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: