Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 58884 invoked from network); 1 Mar 2010 15:29:27 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 1 Mar 2010 15:29:27 -0000 Received: (qmail 11770 invoked by uid 500); 1 Mar 2010 15:29:26 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 11700 invoked by uid 500); 1 Mar 2010 15:29:26 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 11691 invoked by uid 99); 1 Mar 2010 15:29:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Mar 2010 15:29:26 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Mar 2010 15:29:25 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id CBFCC29A0011 for ; Mon, 1 Mar 2010 15:29:05 +0000 (UTC) Message-ID: <942826020.34441267457345834.JavaMail.jira@brutus.apache.org> Date: Mon, 1 Mar 2010 15:29:05 +0000 (UTC) From: "Paul Benedict (JIRA)" To: issues@commons.apache.org Subject: [jira] Commented: (LANG-482) Enhance StrSubstitutor to support nested ${var-${subvr}} expansion In-Reply-To: <1467563774.1233926760096.JavaMail.jira@brutus> 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/LANG-482?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12839712#action_12839712 ] Paul Benedict commented on LANG-482: ------------------------------------ I am not a fan of substitution variables that become substitution variables. It sounds closer to a pre-compiler. Technologies like Maven, Spring, and JSP/JSF do not support this and, likewise, I vote not to apply this. > Enhance StrSubstitutor to support nested ${var-${subvr}} expansion > ------------------------------------------------------------------ > > Key: LANG-482 > URL: https://issues.apache.org/jira/browse/LANG-482 > Project: Commons Lang > Issue Type: Improvement > Components: lang.text.* > Reporter: Rob Walker > Priority: Minor > Fix For: 3.1 > > Attachments: StrSubstitutor.java.nested.patch > > > t would be really handy of StrSubstitutor could support nested variable interpolation: > org.osgi.framework.system.packages=org.osgi.framework; version=1.4.0, \ > org.osgi.service.packageadmin; version=1.2.0, \ > org.osgi.service.startlevel; version=1.1.0, \ > org.osgi.service.url; version=1.0.0, \ > org.osgi.util.tracker; version=1.3.3 \ > ${jre-${java.specification.version}} > The process being to expand innermost variable references first and work outwards - this allows for very advance config, such as the above, which can dynamically detect the Java version and expand a JRE version specific property into the property being defined. > Looking at the implementation, it seems it might be a fairly straightforward enhancement to: > private int substitute(StrBuilder buf, int offset, int length, List priorVariables) > The code already has the cyclic map in place. > I already have code that achieves this within Apache Felix, so I will see if I can retro-fit a similar model to the above and if so submit a patch. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.