MEL created CAMEL-7693:
--------------------------
Summary: PropertyPlaceholder fails when string contains three
consecutive curly brackets
Key: CAMEL-7693
URL: https://issues.apache.org/jira/browse/CAMEL-7693
Project: Camel
Issue Type: Bug
Components: camel-core
Affects Versions: 2.13.2
Reporter: MEL
Priority: Trivial
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 :-
{code}
<setBody>
<simple>{"batch_item":{"item_id": "${header.commaItemId}",
"algorithm_id": "{{comma_algorithm_name}}", "parameters": { "v1": "true"
}}}</simple>
</setBody>
{code}
Note: I can work around the issue if I separate the curly consecutive brackets
with spaces.
Test case to replicate
{code}
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);
}
{code}
--
This message was sent by Atlassian JIRA
(v6.2#6252)