[ 
https://issues.apache.org/jira/browse/CAMEL-9898?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-9898.
--------------------------------
       Resolution: Fixed
    Fix Version/s: 2.18.0

> SimpleBuilder throws NullPointerException when replacing string using 
> regexAll method and the regex contains }
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-9898
>                 URL: https://issues.apache.org/jira/browse/CAMEL-9898
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.17.0
>            Reporter: Lefteris Tsallas
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 2.18.0
>
>
>  
> Add this unit test in org.apache.camel.builder.SimpleBuilderTest to reproduce 
> the issue. Only fails when the regex contains }
> {code}
> public  void testRegexAllWithPlaceHolders() {
>         exchange.getIn().setHeader("activateUrl", 
> "http://some/rest/api/(id)/activate");
>         
> assertEquals("http://some/rest/api/12/activate",SimpleBuilder.simple("${header.activateUrl.replaceAll(\"\\(id\\)\",\"12\")}").evaluate(exchange,String.class));
>         //passes when contains { only
>         exchange.getIn().setHeader("activateUrl", 
> "http://some/rest/api/{id/activate";);
>         
> assertEquals("http://some/rest/api/12/activate",SimpleBuilder.simple("${header.activateUrl.replaceAll(\"\\{id\",\"12\")}").evaluate(exchange,String.class));
>         String replaced  = 
> "http://some/rest/api/{id}/activate".replaceAll("\\{id\\}","12");
>         assertEquals( "http://some/rest/api/12/activate";, replaced);
>         /// But throws throws NullPointerException when regexALl inside a 
> simple expression
>         exchange.getIn().setHeader("activateUrl", 
> "http://some/rest/api/{id}/activate";);
>         
> assertEquals("http://some/rest/api/12/activate",SimpleBuilder.simple("${header.activateUrl.replaceAll(\"\\{id\\}\",\"12\")}").evaluate(exchange,String.class));
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to