Camel
  1. Camel
  2. CAMEL-6445

XML DSL - removeHeaders does not work as expected if more then one excludePatter is speficied

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: website
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      To reproduce put the following in a route:

      <camel:setHeader headerName="header1">
      <camel:constant>1</camel:constant>
      </camel:setHeader>

      <camel:setHeader headerName="header2">
      <camel:constant>2</camel:constant>
      </camel:setHeader>

      <camel:setHeader headerName="header3">
      <camel:constant>3</camel:constant>
      </camel:setHeader>

      <camel:removeHeaders pattern="*" excludePattern="header1,header2" />

      Expected behavior: "header3" should be gone.
      Actual behavior: All headers are gone.

      Specifying only one exclude pattern works. I.e.

      <camel:removeHeaders pattern="*" excludePattern="header1" />

      removes headers "header2" and "header3" but leaves "header1".

        Activity

        Hide
        Christian Müller added a comment -

        I also think we should not make the Camel DSL more complicated if there is already a solution for a given problem.

        Show
        Christian Müller added a comment - I also think we should not make the Camel DSL more complicated if there is already a solution for a given problem.
        Hide
        Ralf Steppacher added a comment -

        Well, if it is just a documentation bug, even better. Thanks for the clarification.

        Show
        Ralf Steppacher added a comment - Well, if it is just a documentation bug, even better. Thanks for the clarification.
        Hide
        Claus Ibsen added a comment -

        They are all patterns and use reg exp for that. So it works as designed. And the example Christian posted is correct, eg use | for OR in reg exp.

        Show
        Claus Ibsen added a comment - They are all patterns and use reg exp for that. So it works as designed. And the example Christian posted is correct, eg use | for OR in reg exp.
        Hide
        Christian Müller added a comment -

        The documentation was misleading about this. I update it and will think about a fix.
        At present, you should use a regular expression like this:

        <removeHeaders pattern="*" excludePattern="header1|header2"/>
        
        Show
        Christian Müller added a comment - The documentation was misleading about this. I update it and will think about a fix. At present, you should use a regular expression like this: <removeHeaders pattern= "*" excludePattern= "header1|header2" />

          People

          • Assignee:
            Christian Müller
            Reporter:
            Ralf Steppacher
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development