Return-Path: Delivered-To: apmail-commons-user-archive@www.apache.org Received: (qmail 93068 invoked from network); 10 Oct 2007 19:49:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Oct 2007 19:49:59 -0000 Received: (qmail 74847 invoked by uid 500); 10 Oct 2007 19:48:37 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 74798 invoked by uid 500); 10 Oct 2007 19:48:37 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 74787 invoked by uid 99); 10 Oct 2007 19:48:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Oct 2007 12:48:37 -0700 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_HELO_PASS,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [212.227.126.174] (HELO moutng.kundenserver.de) (212.227.126.174) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Oct 2007 19:48:39 +0000 Received: from [192.168.178.20] (p5B09AB4D.dip0.t-ipconnect.de [91.9.171.77]) by mrelayeu.kundenserver.de (node=mrelayeu4) with ESMTP (Nemesis) id 0ML21M-1IfhXU33b5-0002NO; Wed, 10 Oct 2007 21:48:17 +0200 Message-ID: <470D2C81.7010201@oliver-heger.de> Date: Wed, 10 Oct 2007 21:48:17 +0200 From: Oliver Heger User-Agent: Thunderbird 1.5.0.8 (Windows/20061025) MIME-Version: 1.0 To: Jakarta Commons Users List Subject: Re: Jakarta Commons Configuration - Problem with Variable Interpolation and StringArray References: <470BFABC.6020809@anderson.ucla.edu> In-Reply-To: <470BFABC.6020809@anderson.ucla.edu> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V01U2FsdGVkX1+Vs/Eo3OewQvdTAatycYeL7HG7xTbSFpzEw2c Y3Ai48WUuAVvVQ/N6nyJL30ja4NN2oyAUSV1nh5usBWjK83Itu HmBewuzME+aI2UKxEz1cA== X-Virus-Checked: Checked by ClamAV on apache.org James Watkin wrote: > I'm able to use Jakarta Commons Configuration with .properties files and > String[] properties, but when I use variable interpolation to refer to a > String[] property, it only returns the first element. Example: > > .properties file contents: > test.email.addresses = firstName1.LastName1@mydomain.edu, > firstName2.LastName2@mydomain.edu > > test.email.recipients = ${test.email.addresses} > > > Code: > String[] testEmailAddresses = > config.getStringArray("test.email.addresses"); > > String[] testEmailRecipients = > config.getStringArray("test.email.recipients"); > > System.out.println("testEmailAddresses = " + > ArrayUtils.toString(testEmailAddresses)); > > System.out.println("testEmailRecipients = " + > ArrayUtils.toString(testEmailRecipients)); > > > Output: > testEmailAddresses = > {firstName1.LastName1@mydomain.edu,firstName2.LastName2@mydomain.edu} > testEmailRecipients = {firstName1.LastName1@mydomain.edu} > > Shouldn't testEmailRecipients get the same String[] value as > testEmailAddresses? Am I doing something wrong, or can't this be done? > Is there a special recursive variable interpolation character for arrays? > > - Jim I am sorry, but interpolation of array values is not supported. Our interpolation implementation is pretty much String-based (behind the scenes we use the text package of Commons Lang [1], which only operates on Strings). So extending this to other types or even arrays and collections won't be trivial. Oliver [1] http://commons.apache.org/lang/ --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org