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

Claus Ibsen commented on CAMEL-10951:
-------------------------------------

The code is something a like
{code}
            FieldSource field = getField(clazz, block, (SimpleName) arg);

                    // the field may be initialized using variables, so we need 
to evaluate those expressions
                    Object fi = field.getInternal();
                    if (fi instanceof VariableDeclaration) {
                        Expression exp = ((VariableDeclaration) 
fi).getInitializer();
                        String uri = 
CamelJavaParserHelper.getLiteralValue(clazz, block, exp);
                        if (!Strings.isBlank(uri)) {
                            // we want the position of the field, and not in 
the route
                            int position = ((VariableDeclaration) 
fi).getStartPosition();
                            uris.add(new ParserResult(node, position, uri));
                        }
                    }
                }
{code}

See the CamelJavaParserHelper

Its that initialize stuff that is another expression you can then grab and then 
find its value is a string, integer or something


> Invalid default field values in Spring Boot ComponentConfiguration classes
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-10951
>                 URL: https://issues.apache.org/jira/browse/CAMEL-10951
>             Project: Camel
>          Issue Type: Bug
>    Affects Versions: 2.19.0
>            Reporter: James Netherton
>            Assignee: Nicola Ferraro
>
> Some components default their endpoint configuration using constant fields. 
> For example, the camel-mail {{MailConfiguration}} class has:
> {code}
> private String from = MailConstants.MAIL_DEFAULT_FROM;
> {code}
> When the MailComponentConfiguration is generated, it has a field defaulted as 
> follows:
> {code}
> private String from = "MailConstants.MAIL_DEFAULT_FROM";
> {code}
> Not sure exactly how many components are impacted by this but there's a few 
> listed if you do:
> {code}
> grep "DEFAULT" $(find . -name "*ComponentConfiguration.java")
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to