Federico Mariani created CAMEL-27116:
----------------------------------------
Summary: camel-file, camel-ftp, camel-smb - noop with delete or
move, a fileName with wildcards and a classpath: directory start silently, and
include=*.xml fails with only the regex parser message
Key: CAMEL-27116
URL: https://issues.apache.org/jira/browse/CAMEL-27116
Project: Camel
Issue Type: Improvement
Components: camel-ftp, camel-file, camel-smb
Reporter: Federico Mariani
Several consumer options of the file components start without a word but do not
do what they say. They are shared by file, ftp, ftps, sftp, smb, azure-files
and mina-sftp.
* {{noop=true}} with {{delete=true}}: delete wins, and the consumer deletes the
files. {{noop=true}} with {{move}}: noop wins, and the files are not moved.
Only {{delete=true}} with {{move}} is rejected.
* {{fileName}} is a file name compared with {{equals}}: {{fileName=*.csv}}
consumes no file, and the route polls forever.
* {{file:classpath:data}} (or {{file:resource:classpath:}}) is a directory of
the file system named {{classpath:data}}, which the consumer creates in the
working directory.
* {{include}} and {{exclude}} are regular expressions. {{include=*.xml}} fails
at startup with only the message of the regex parser ({{Dangling meta character
'*' near index 0}}), which does not say that the option is a regex nor name
antInclude or includeExt.
* A {{$\{ \}}} placeholder in the directory fails with "Dynamic expressions
with $\{ \} placeholders is not allowed. Use the fileName option to set the
dynamic expression.", which does not say how to read or write a dynamic
directory.
{code:java}
from("file:inbox?noop=true&delete=true").to("log:a"); // deletes the files
from("file:inbox?noop=true&move=done").to("log:b"); // does not move them
from("file:inbox?fileName=*.csv").to("log:c"); // consumes nothing
from("file:classpath:data?fileName=a.txt").to("log:d"); // creates
./classpath:data
from("file:inbox?include=*.xml").to("log:e"); // Dangling meta
character '*' near index 0
from("direct:a").to("file:archive/${header.month}"); // Invalid directory
... Use the fileName option
{code}
Expected: creating the consumer logs a WARN for the first four that says what
happens and which option to use ({{delete}} or {{noop}}, {{antInclude}}, the
language component such as {{language:constant:resource:classpath:...}}). The
behaviour does not change, so these routes still start as before. The
include/exclude error says that the option is a regular expression (such as
{{.*\.xml}}) and names antInclude/antExclude and includeExt/excludeExt. The
placeholder error keeps its text and adds that the directory is fixed when the
endpoint is created, with toD to write and pollEnrich with a simple expression
to read.
_Claude Code on behalf of Federico Mariani_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)