Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-7693

PropertyPlaceholder fails when string contains three consecutive curly brackets

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Trivial
    • Resolution: Won't Fix
    • 2.13.2
    • None
    • camel-core
    • None
    • Unknown

    Description

      I've attempted to update my Camel project from version 2.13.1 to 2.13.2, however my unit tests now fail due to the way in which the PropertiesComponent now treats three curly brackets that are in a JSON string I am building using property values.

      E.g.: I have this in my route definition :-

      <setBody>
      	<simple>{"batch_item":{"item_id": "${header.commaItemId}", "algorithm_id": "{{comma_algorithm_name}}", "parameters": { "v1": "true" }}}</simple>
      </setBody>
      

      Note: I can work around the issue if I separate the curly consecutive brackets with spaces.

      Test case to replicate

      public class PropertiesComponentSimpleLanguageTest extends 
      ContextTestSupport {
      
      ......
          public void testPropertiesComponentDualSimpleLanguage_MEL() throws Exception {
              context.addRoutes(new RouteBuilder() {
                  @Override
                  public void configure() throws Exception {
                      String jsonTestString = "{\"prefsObj\": {\"person\":\"${body}\", \"likesObj\": {\"itemA\":\"{{cheese.quote}}\", \"itemB\":\"{{cheese.type}}\"}}}";
                      // String jsonTestString = "{\"prefsObj\": {\"person\":\"${body}\", \"likesObj\": {\"itemA\":\"{{cheese.quote}}\", \"itemB\":\"{{cheese.type}}\"} } }";
      
                      from("direct:start").transform().simple(jsonTestString);
                  }
              });
              context.start();
      
              String reply = template.requestBody("direct:start", "Claus", String.class);
              // assertEquals("{\"prefsObj\": {\"person\":\"Claus\", \"likesObj\": {\"itemA\":\"Camel rocks\", \"itemB\":\"Gouda\"} } }", reply);
              assertEquals("{\"prefsObj\": {\"person\":\"Claus\", \"likesObj\": {\"itemA\":\"Camel rocks\", \"itemB\":\"Gouda\"}}}", reply);
          }
      

      Attachments

        Issue Links

          Activity

            People

              njiang Willem Jiang
              Langtonm MEL
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: