You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Siarhei Krukau (JIRA)" <ji...@apache.org> on 2018/09/04 23:08:00 UTC

[jira] [Closed] (CAMEL-8307) Properties are loaded only from the first source if whitespaces are used in propertyPlaceholder#location

     [ https://issues.apache.org/jira/browse/CAMEL-8307?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Siarhei Krukau closed CAMEL-8307.
---------------------------------

> Properties are loaded only from the first source if whitespaces are used in propertyPlaceholder#location
> --------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-8307
>                 URL: https://issues.apache.org/jira/browse/CAMEL-8307
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.12.0
>            Reporter: Siarhei Krukau
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 2.14.2, 2.15.0
>
>
> When whitespaces or newlines are used in {{location}} attribute of {{propertyPlaceholder}} (XML):
> {code:xml}
> <propertyPlaceholder id="camelPropertyPlaceholderConfigurer"
>     location="classpath:a/b/c/environments/base.properties,
>               classpath:a/b/c/environments/${env:ENV}/env.properties,
>               classpath:a/b/c/environments/${ENV}/env.properties"
>     ignoreMissingLocation="true"/>
> {code}
> , the properties are loaded only from the first source ({{base.properties}}) in this case. The problem may be in {{org.apache.camel.component.properties.DefaultPropertiesResolver#loadPropertiesFromClasspath}}:
> {code:java}
>     protected Properties loadPropertiesFromClasspath(CamelContext context, boolean ignoreMissingLocation, String path) throws IOException {
>         Properties answer = new Properties();
>         if (path.startsWith("classpath:")) {
>             path = ObjectHelper.after(path, "classpath:");
>         }
>         InputStream is = context.getClassResolver().loadResourceAsStream(path);
>         if (is == null) {
>            ...
>         } else {...}
>         return answer;
>     }
> {code}
> {{startsWith}} returns false as the path are splitted around {{,}}. Trimming the path somewhere around those calls may help.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)