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:

However, if I have multiple entries, that is when I am getting the error:

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


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

IIRC in earlier versions of Configuration escaping variables was not supported.


To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to