camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-11524) Camel File Consumer fails when doneFileName contains '$'
Date Sun, 09 Jul 2017 08:12:01 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-11524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16079501#comment-16079501
] 

Claus Ibsen commented on CAMEL-11524:
-------------------------------------

No there is not, your workaround is to not use $ in the file name, which also is a bad habit
to do so.

The source code needs to be patched where you need to quote the file name in the GenericFileEndpoint
method via java.util.regex.Matcher#quoteReplacement. You are welcome to work on a github PR
to fix this

> Camel File Consumer fails when doneFileName contains '$'
> --------------------------------------------------------
>
>                 Key: CAMEL-11524
>                 URL: https://issues.apache.org/jira/browse/CAMEL-11524
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.18.2
>         Environment: * Java8
> * Camel 2.18.2
> * Karaf 4.0.9
>            Reporter: Saikat Ghosh
>             Fix For: 2.18.5, 2.19.2, 2.20.0
>
>
> I have running a blueprint file with a camel context that has the following:
> {code:xml}
>          <from uri="file:///{{backupFolder}}?doneFileName=${file:name}.4camel&amp;recursive=true&amp;delete=true"/>
> {code}
> 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?
> {noformat}
> 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]
> {noformat}
> Thanks, Saycat



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message