[ 
https://issues.apache.org/jira/browse/CAMEL-3802?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13010934#comment-13010934
 ] 

Charles Moulliard commented on CAMEL-3802:
------------------------------------------

I suggest that we add a test to check if the first character of the body is a 
bracket. If this is the case, than we should no remove the dots from the key 
value

code to be changed

{code}
    public static Expression headersOgnlExpression(final String ognl) {
        return new ExpressionAdapter() {
            public Object evaluate(Exchange exchange) {
                // try with full name first
                Object header = exchange.getIn().getHeader(ognl);
                if (header != null) {
                    return header;
                }

                // split into first name
                List<String> methods = OgnlHelper.splitOgnl(ognl);
                // remove any OGNL operators so we got the pure key name
                String key = OgnlHelper.removeOperators(methods.get(0));

                header = exchange.getIn().getHeader(key);
                if (header == null) {
                    return null;
                }
                // the remainder is the rest of the ognl without the key
                String remainder = ObjectHelper.after(ognl, key);
                return new MethodCallExpression(header, 
remainder).evaluate(exchange);
            }

            @Override
            public String toString() {
                return "headerOgnl(" + ognl + ")";
            }
        };
    }
{code}

> Simple language and OGNL does not support dots in key name
> ----------------------------------------------------------
>
>                 Key: CAMEL-3802
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3802
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.6.0
>            Reporter: Charles Moulliard
>            Priority: Minor
>             Fix For: 2.8.0
>
>
> It is not possible in a simple expression to have access to a key of a Map 
> when the key name contains dots
> ex : 
> <simple>${body[com.fusesource.webinars.persistence.model.Incident]}</simple>
> where com.fusesource.webinars.persistence.model.Incident is the key name
> Camel generates the error :
> {code}
> Caused by: org.apache.camel.component.bean.MethodNotFoundException: Method 
> with name: [com not found on bean: 
> [{com.fusesource.webinars.persistence.model.Incident=com.fusesource.webinars.persistence.model.Incident@7fec0e19[
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to