[ 
https://issues.apache.org/jira/browse/CAMEL-13962?focusedWorklogId=311270&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-311270
 ]

ASF GitHub Bot logged work on CAMEL-13962:
------------------------------------------

                Author: ASF GitHub Bot
            Created on: 12/Sep/19 08:34
            Start Date: 12/Sep/19 08:34
    Worklog Time Spent: 10m 
      Work Description: mpaetzold commented on pull request #3165: CAMEL-13962: 
keep track of brackets that belong to a method in order …
URL: https://github.com/apache/camel/pull/3165
 
 
   … to prevent false method splitting
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

            Worklog Id:     (was: 311270)
    Remaining Estimate: 0h
            Time Spent: 10m

> OgnlHelper.splitOgnl not able to handle Regex properly
> ------------------------------------------------------
>
>                 Key: CAMEL-13962
>                 URL: https://issues.apache.org/jira/browse/CAMEL-13962
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.24.1, 3.0.0.RC1
>            Reporter: Michael Pätzold
>            Priority: Minor
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> The splitOgnl method cannot properly handle an expression if it contains 
> numerous paranthesis brackets and dots what is very likely in case you want 
> to use regular expressions.
> The following examples tries to extract a specific cookie value from the 
> cookie string that's contained within the headers:
> {code:java}
>     @Test
>     public void splitOgnlWithRegexInMethod() {
>         String ognl = 
> "header.cookie.replaceFirst(\".*;?iwanttoknow=([^;]+);?.*\", \"$1\")";
>         assertFalse(OgnlHelper.isInvalidValidOgnlExpression(ognl));
>         assertTrue(OgnlHelper.isValidOgnlExpression(ognl));
>         List<String> strings = OgnlHelper.splitOgnl(ognl);
>         assertEquals(3, strings.size());
>         assertEquals("header", strings.get(0));
>         assertEquals(".cookie", strings.get(1));
>         assertEquals(".replaceFirst(\".*;?iwanttoknow=([^;]+);?.*\", 
> \"$1\")", strings.get(2));
>     }
> {code}
> The test fails using the current code base since the regular expression 
> itself is split at the first dot after the first closing paranthesis bracket.
> If you'll agree that this is a bug I can come up with a possible solution 
> that takes the amount of opening/closing brackets into account via PR.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to