commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oliver Heger (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (CONFIGURATION-256) MapConfiguration does not decode escaped Delimiters
Date Tue, 06 Mar 2007 21:21:25 GMT

     [ https://issues.apache.org/jira/browse/CONFIGURATION-256?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Oliver Heger resolved CONFIGURATION-256.
----------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.4

MapConfiguration and all the web-based configurations were updated to correctly remove the
escaping character for the list delimiter. Additional tests were added to verify this behavior.

Please double-check. Thanks.

> MapConfiguration does not decode escaped Delimiters
> ---------------------------------------------------
>
>                 Key: CONFIGURATION-256
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-256
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.3
>         Environment: I think it does not matter because of pure java
>            Reporter: Michal Polak
>         Assigned To: Oliver Heger
>             Fix For: 1.4
>
>
> Hello, I don't know how to reopen resolved bug. See: https://issues.apache.org/jira/browse/CONFIGURATION-30
> There is BAD implementation in MapConfiguration.getProperty(String key) method:
> As "return value" should be list.get(0) instead of "value".
> PropertyConverter.split removes escape chars....
> Suggested correction:
>     public Object getProperty(String key)
>     {
>         Object value = map.get(key);
>         if ((value instanceof String) && (!isDelimiterParsingDisabled()))
>         {
>             List list = PropertyConverter.split((String) value, getListDelimiter());
>             //MP: return list.size() > 1 ? list : value;
>             return list.size() > 1 ? list : list.get(0); //MP: split removes escape
chars
>         }
>         else
>         {
>             return value;
>         }
>     }
> Test code:
> Map m = new HashMap();
> m.put("foo", "bar\\,baz");
> m.put("bar", "bar, baz");
> MapConfiguration mc = new MapConfiguration(m);
> mc.setDelimiterParsingDisabled(false);
> mc.setListDelimiter(',');
> Configuration c = mc;
> String bad = c.getString("foo"); //<-- returns "bar\\, baz" expected "bar, baz"
> String ok = c.getString("bar"); // <-- returns "bar"
> System.err.println("Bad: " + bad);
> System.err.println("OK: " + ok);
> Current result is:
> Bad: bar\,baz
> OK: bar

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


Mime
View raw message