commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Westerman <dlwes...@comcast.net>
Subject Re: [commons-configuration] Variable Syntax Conflict
Date Mon, 25 Jun 2007 22:17:42 GMT
Oliver, thanks for the info. I am indeed using release 1.3. And you're 
right, the $$ does escape the variable character, in some circumstances.

I didn't get much time to work on this today, but when I changed it to 
only have one entry in the property that looks like a variable, it works 
okay:
myproperty=$${DB2UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc.jar

However, if I have multiple entries, that is when I am getting the error:
myproperty=$${DB2UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc.jar,$${DB2UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc_license_cu.jar,$${DB2UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc_license_cisuz.jar

I need to do some more testing, to see what combinations of this work 
and which ones don't. But thanks for giving me something to go on!

Oliver Heger wrote:
> Hi Dave,
>
> which version of Commons Configuration do you use? Since the 1.3 
> release substituation of variables is handled by the StrSubstitutor 
> class of Commons Lang [1]. Here the '$' sign is used for escaping 
> variables, so your 3rd example
>
> myproperty=$${myNonCommonsConfigVariable}
>
> should work. There is also a unit test that checks this behavior:
>
>     public void testInterpolationEscaped()
>     {
>         config.addProperty("var", "x");
>         config.addProperty("escVar", "Use the variable $${${var}}.");
>         assertEquals("Wrong escaped variable", "Use the variable 
> ${x}.", config
>                 .getString("escVar"));
>     }
>
> IIRC in earlier versions of Configuration escaping variables was not 
> supported.
>
> Oliver



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


Mime
View raw message