[
https://issues.apache.org/jira/browse/CAMEL-7693?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14096784#comment-14096784
]
Willem Jiang edited comment on CAMEL-7693 at 8/14/14 10:04 AM:
---------------------------------------------------------------
This issue is introduced by CAMEL-7429 which support to concatenation
properties. As the patch is based on looking SuffixIndex first to decide if
there is property need to be parsed, the consecutive curly brackets introduces
the ambiguity.
It makes sense that camel throw the exception like this:
{code}
Caused by: java.lang.IllegalArgumentException: Missing {{ from the text:
{json:{value:junit}}
at
org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.readProperty(DefaultPropertiesParser.java:128)
at
org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.doParse(DefaultPropertiesParser.java:91)
at
org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.parse(DefaultPropertiesParser.java:78)
at
org.apache.camel.component.properties.DefaultPropertiesParser.parseUri(DefaultPropertiesParser.java:43)
at
org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:160)
at
org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:119)
at
org.apache.camel.impl.DefaultCamelContext.resolvePropertyPlaceholders(DefaultCamelContext.java:1256)
at
org.apache.camel.model.ProcessorDefinition.resolvePropertyPlaceholders(ProcessorDefinition.java:572)
at
org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:487)
at
org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:213)
at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:932)
... 28 more
{code}
was (Author: njiang):
This issue is introduced by CAMEL-7429.
> 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)