commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <ralph.go...@dslextreme.com>
Subject Re: [Configuration]JEXL question
Date Sat, 29 Aug 2009 17:35:09 GMT

On Aug 29, 2009, at 6:33 AM, rzo wrote:

> Hello,
>
> thanks for mentioning jexl scripting.
> I tried it out and have found the following issue:
>
> evaluating the following:
>
> test=${expr:if (System.getProperty("user.home").startsWith("C"))  
> {"x";} else {"z";}}
>
> does not seem to work.
> Debuging shows that the expression forwarded to jexl is:
>
> if (System.getProperty("user.home").startsWith("C")) {"x";
>
> is this a bug ? or is there a way to escape the brackets within $ 
> {...} ?
>

The "bug" is actually the way  
org.apache.commons.lang.text.StrSubstitutor works. It can configured  
be with prefix and suffix characters - the defaults are '{' and '}'  
and after finding the prefix it just searches for the first occurance  
of the suffix character - unless it finds a recursive variable. So the  
string passed to ConfigurationInterpolator is what you show above.

However, it might be possible to override the suffix matcher to look  
for an escape character.

Ralph


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message