commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Heger <oliver.he...@oliver-heger.de>
Subject Re: [Configuration]: Escaping list delimiter
Date Mon, 21 May 2007 20:14:35 GMT
uma_rk@comcast.net wrote:
>   > With the escaping of the delimiter character there was a bug in 
>   > Configuration 1.4, which has been fixed recently [1]. Maybe this fix 
>   > solves your problem?
> 
> Thanks. I am using 1.4 - is this bugfix available in a new minor release
> or do I have to build from source to get the fix?
> 
> If this patch does not fix the problem, I will attach the relevant excerpts
> from my implementation.
> 
> Thanks
> 
> /U
> 

There is no new bugfix release since 1.4, but you can get a recent 
nightly build from [1].

However I did some testing and found out that this fix will probably not 
solve your problem: it is specific to XMLConfiguration, but it seems 
that PropertiesConfiguration does not properly treat the delimiter (and 
escaping) character, too.

I will do some more investigation.

Anyway, thanks for spotting this!

Oliver

[1] 
http://people.apache.org/builds/jakarta-commons/nightly/commons-configuration/

> 
>  -------------- Original message ----------------------
> From: Oliver Heger <oliver.heger@oliver-heger.de>
>> uma_rk@comcast.net wrote:
>>> Loading the properties has no effect (btw, loading properties is 
>>> applicable for instances of AbstractFileConfiguration alone correct?).
>>>
>>> Also, setDelimiterParsingDisabled(true) causes 
>> PropertiesConfiguration.save(Writer)
>>> to escape every delimiter in the file. Yet, when I read the properties back,
>>> the delimiters are not escaped (they are parsed).
>>>
>>> I am stuck either way - it won't parse delimiters properly (ignores escapes)

>> when
>>> delimiter parsing is enabled and it won't let me handle delimiters myself
>>> by disabling delimiter parsing.
>>>
>>> I am at my wit's end and would appreciate any advice from anyone who has
>>> gotten this working.
>>>
>>> Regards,
>>>
>>> /U
>>>
>> Without having concrete code samples it is hard to guess what is going 
>> wrong. It is correct that setDelimiterParsingDisabled() has to be called 
>> before the configuration is loaded.
>>
>> With the escaping of the delimiter character there was a bug in 
>> Configuration 1.4, which has been fixed recently [1]. Maybe this fix 
>> solves your problem?
>>
>> Oliver
>>
>> [1] 
>> https://issues.apache.org/jira/browse/CONFIGURATION-268?page=com.atlassian.jira.
>> plugin.system.issuetabpanels:all-tabpanel
>>
>>>  -------------- Original message ----------------------
>>> From: "Giriraj Vengurleker" <gvengurlekar@serus.com>
>>>> Make sure that that you first disable the Delim parsing on the Configuration
>>>> object and then load the property file.
>>>>
>>>> -giriraj
>>>>
>>>> -----Original Message-----
>>>> From: uma_rk@comcast.net [mailto:uma_rk@comcast.net] 
>>>> Sent: Friday, May 18, 2007 2:01 PM
>>>> To: Jakarta Commons Users List; Jakarta Commons Users List
>>>> Cc: Oliver Heger
>>>> Subject: Re: [Configuration]: Escaping list delimiter
>>>>
>>>>
>>>> Thanks a lot. Also, AbstractConfiguration.setDelimiterParsingDisabled(true)
>>>> does not seem to take effect. It continues to split the property values
>>>> as fields based on the default delimiter.
>>>>
>>>> I am using 1.4. Is this a known issue?
>>>>
>>>> Thanks,
>>>>
>>>> /U
>>>>
>>>>  -------------- Original message ----------------------
>>>> From: Oliver Heger <oliver.heger@oliver-heger.de>
>>>>> uma_rk@comcast.net wrote:
>>>>>> How can I escape list delimiter characters in property configuration?
>>>>>>
>>>>>>     my.strings=silk,cotton               # List of two strings
>>>>>>     my.strings=silk,cott\,on             # List of two strings again
>>>>>>     my.strings=silk,cott,on              # List of three strings
>>>>>>
>>>>>> However, escaping the list delimiter as above does not seem to work.
>>>>>> How can I accomplish what I am trying to do?
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> /U
>>>>>>
>>>>> The backslash is the correct escaping character. But AFAIK it is
>>>>> specially treated in Java properties files [1], so it has to be escaped
>>>>> itself by using a duplicate backslash:
>>>>>
>>>>> my.strings = silk,cott\\,on
>>>>>
>>>>> HTH
>>>>> Oliver
>>>>>
>>>>> [1]
>>>>>
>>>> http://java.sun.com/javase/6/docs/api/java/util/Properties.html#load(java.io
>>>> .Rea
>>>>> der)
>>>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
> 


---------------------------------------------------------------------
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