You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2007/02/12 12:38:22 UTC

DO NOT REPLY [Bug 35442] - [configuration] MapConfiguration does not decode escaped Delimiters

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=35442>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=35442


mpolak@email.cz changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WORKSFORME                  |




------- Additional Comments From mpolak@email.cz  2007-02-12 03:38 -------
Hi, I would like to reopen this bug, because IMHO it still exists in
commons-configuration-1.2.jar. :-)

Behaviour of --code-sample-- originally posted by Martin Treusch von Buttlar is
same as mine.
Problematic code (MapConfiguration.getProperty) :

List list = PropertyConverter.split((String) value, getDelimiter());
return list.size() > 1 ? list : value;

Variable 'value' still contains backslashes as escape chars.
Backslashes are removed by PropertyConverter.split
I think same bugs are in:

AppletConfiguration.getProperty
ServletConfiguration.getProperty
ServletContextConfiguration.getProperty
ServletFilterConfiguration.getProperty

Property and XML configuration are OK, I think.

Resolve proposal:
public Object getProperty(String key)
    {
        Object value = map.get(key);
        if (value instanceof String)
        {
            List list = PropertyConverter.split((String) value, getDelimiter());
            //Bad code:
            //return list.size() > 1 ? list : value;
            //MP: value still contains backslashes as escape chars.
            //So correction is very easy:
            return list.size() > 1 ? list : list.get(0);
        }
        else
        {
            return value;
        }
    }

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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