Dave Westerman wrote:
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!

Is it possible that your problem is related to list parsing? (You have the "," in your property value, which will be interpreted as list delimiter per default, resulting in a property with multiple values.)

I have written a test case that looks roughly like this:

config.addProperty("mypath",
"$${DB2UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc.jar\\,$${DB2UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc_license_cu.jar");

assertEquals("Wrong interpolated value", "${DB2UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc.jar,${DB2UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc_license_cu.jar", config.getString("mypath"));

This works for me. Note that I escaped the "," character. (The test also works if the "," is not escaped, but then only the first part of the value string will be returned by getString().)

If you think there is a bug in the interpolation handling, please open a ticket in our bug tracking system [1].

Thanks
Oliver

[1] http://jakarta.apache.org/commons/configuration/issue-tracking.html


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



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

Reply via email to