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

Camel File Consumer fails when doneFileName contains '$'

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.18.2
    • 2.18.5, 2.19.2, 2.20.0
    • camel-core
    • None
      • Java8
      • Camel 2.18.2
      • Karaf 4.0.9
    • Novice

    Description

      I have running a blueprint file with a camel context that has the following:

               <from uri="file:///{{backupFolder}}?doneFileName=${file:name}.4camel&amp;recursive=true&amp;delete=true"/>
      

      This causes Camel to throw the following exception when I receive files with names of the following form: YY049608$SQLEXPRESS_TEST1_FULL_20170709_160016.bak

      Most likely the '$' in the name is the problem. Is there any way to escape it?

      2017-07-09 15:33:03,496 | WARN  | %5Cbackup-folder | FileConsumer                     | 46 - org.apache.camel.camel-core - 2.18.2 | Consumer Consumer[file:///C:%5CUsers%5C300227639%5CDesktop%5Colivia-demo%5Cassembly%5Cdeployables%5C..%5Cdata%5Cbackup-folder?delete=true&doneFileName=%24%7Bfile%3Aname%7D.done&recursive=true] failed polling endpoint: file:///C:%5CUsers%5C300227639%5CDesktop%5Colivia-demo%5Cassembly%5Cdeployables%5C..%5Cdata%5Cbackup-folder?delete=true&doneFileName=%24%7Bfile%3Aname%7D.done&recursive=true. Will try again at next poll. Caused by: [java.lang.IllegalArgumentException - Illegal group reference]
      java.lang.IllegalArgumentException: Illegal group reference
              at java.util.regex.Matcher.appendReplacement(Matcher.java:857)[:1.8.0_101]
              at java.util.regex.Matcher.replaceFirst(Matcher.java:1004)[:1.8.0_101]
              at java.lang.String.replaceFirst(String.java:2178)[:1.8.0_101]
              at org.apache.camel.component.file.GenericFileEndpoint.createDoneFileName(GenericFileEndpoint.java:1301)[46:org.apache.camel.camel-core:2.18.2]
              at org.apache.camel.component.file.GenericFileConsumer.isMatched(GenericFileConsumer.java:670)[46:org.apache.camel.camel-core:2.18.2]
              at org.apache.camel.component.file.GenericFileConsumer.isValidFile(GenericFileConsumer.java:545)[46:org.apache.camel.camel-core:2.18.2]
              at org.apache.camel.component.file.FileConsumer.pollDirectory(FileConsumer.java:114)[46:org.apache.camel.camel-core:2.18.2]
              at org.apache.camel.component.file.FileConsumer.pollDirectory(FileConsumer.java:107)[46:org.apache.camel.camel-core:2.18.2]
              at org.apache.camel.component.file.FileConsumer.pollDirectory(FileConsumer.java:107)[46:org.apache.camel.camel-core:2.18.2]
              at org.apache.camel.component.file.FileConsumer.pollDirectory(FileConsumer.java:107)[46:org.apache.camel.camel-core:2.18.2]
              at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:132)[46:org.apache.camel.camel-core:2.18.2]
              at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:175)[46:org.apache.camel.camel-core:2.18.2]
              at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:102)[46:org.apache.camel.camel-core:2.18.2]
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_101]
              at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)[:1.8.0_101]
              at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)[:1.8.0_101]
              at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)[:1.8.0_101]
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_101]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_101]
              at java.lang.Thread.run(Thread.java:745)[:1.8.0_101]
      

      Thanks, Saycat

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            onders Onder Sezgin
            saycat Saikat Ghosh
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment