Return-Path: X-Original-To: apmail-camel-issues-archive@minotaur.apache.org Delivered-To: apmail-camel-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 789B71796E for ; Mon, 2 Feb 2015 15:44:40 +0000 (UTC) Received: (qmail 63567 invoked by uid 500); 2 Feb 2015 15:44:35 -0000 Delivered-To: apmail-camel-issues-archive@camel.apache.org Received: (qmail 63535 invoked by uid 500); 2 Feb 2015 15:44:35 -0000 Mailing-List: contact issues-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list issues@camel.apache.org Received: (qmail 63524 invoked by uid 99); 2 Feb 2015 15:44:35 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Feb 2015 15:44:35 +0000 Date: Mon, 2 Feb 2015 15:44:34 +0000 (UTC) From: "Siarhei Krukau (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CAMEL-8307) Loaded properties are empty if whitespaces are used in propertyPlaceholder#location MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CAMEL-8307?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Siarhei Krukau updated CAMEL-8307: ---------------------------------- Description: When whitespaces or newlines are used in {{location}} attribute of {{propertyPlaceholder}} (XML): {code:xml} {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. was: When whitespaces are used in {{location}} attribute of {{propertyPlaceholder}} (XML): {code:xml} {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. > Loaded properties are empty if whitespaces are used in propertyPlaceholder#location > ----------------------------------------------------------------------------------- > > Key: CAMEL-8307 > URL: https://issues.apache.org/jira/browse/CAMEL-8307 > Project: Camel > Issue Type: Bug > Components: camel-core > Affects Versions: 2.12.0 > Reporter: Siarhei Krukau > Priority: Minor > > When whitespaces or newlines are used in {{location}} attribute of {{propertyPlaceholder}} (XML): > {code:xml} > 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 (v6.3.4#6332)