You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Claudio R <us...@yahoo.com.br> on 2015/08/09 02:58:01 UTC

Problem using include with regexp

Hi,
I am trying execute the java code below to process only files with name (n20.xml, n25.xml etc)

from("file:c:/camel/src/data?delete=true&include=n[\\d]+\\.xml")

I do not want to process files with name n.xml for example.
The problem is the Camel doesn´t catch the files in directory.
Is it a bug?
The reg exp (Java) is correct.
I am using Camel version 2.14.0 with java 1.6.0_15

Re: Problem using include with regexp

Posted by Claudio R <us...@yahoo.com.br>.
Hi Claus,I changed the code as you indicated

from("file:c:/camel/src/data?delete=true&include=RAW(n[\\d]+\\.xml)")

Now it worked.
Thank you very much.
 


     Em Domingo, 9 de Agosto de 2015 4:10, Claus Ibsen <cl...@gmail.com> escreveu:
   

 Hi

You can use the raw() syntax
http://camel.apache.org/how-do-i-configure-endpoints.html

On Sun, Aug 9, 2015 at 2:58 AM, Claudio R <us...@yahoo.com.br> wrote:
> Hi,
> I am trying execute the java code below to process only files with name (n20.xml, n25.xml etc)
>
> from("file:c:/camel/src/data?delete=true&include=n[\\d]+\\.xml")
>
> I do not want to process files with name n.xml for example.
> The problem is the Camel doesn´t catch the files in directory.
> Is it a bug?
> The reg exp (Java) is correct.
> I am using Camel version 2.14.0 with java 1.6.0_15



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition: http://www.manning.com/ibsen2

  

Re: Problem using include with regexp

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You can use the raw() syntax
http://camel.apache.org/how-do-i-configure-endpoints.html

On Sun, Aug 9, 2015 at 2:58 AM, Claudio R <us...@yahoo.com.br> wrote:
> Hi,
> I am trying execute the java code below to process only files with name (n20.xml, n25.xml etc)
>
> from("file:c:/camel/src/data?delete=true&include=n[\\d]+\\.xml")
>
> I do not want to process files with name n.xml for example.
> The problem is the Camel doesn´t catch the files in directory.
> Is it a bug?
> The reg exp (Java) is correct.
> I am using Camel version 2.14.0 with java 1.6.0_15



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition: http://www.manning.com/ibsen2

Re: Problem using include with regexp

Posted by rishabhtulsian <ri...@gmail.com>.
Looks like a bug to me. By default all components encode the URI string for
the endpoint

    public boolean DefaultComponent::useRawUri() {
        // should use encoded uri by default
        return false;
    }

The FileComponent does not override it.
In GenericFileConsumer::isMatched method this code 
            if (!name.matches(endpoint.getInclude())) {
                return false;
            }
uses the encoded regex string and hence 'matches' returns false.

-rishabh



--
View this message in context: http://camel.465427.n5.nabble.com/Problem-using-include-with-regexp-tp5770477p5770479.html
Sent from the Camel - Users mailing list archive at Nabble.com.