[ https://issues.apache.org/jira/browse/CONFIGURATION-256?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michal Polak updated CONFIGURATION-256: --------------------------------------- I think same bugs are in: AppletConfiguration.getProperty ServletConfiguration.getProperty ServletContextConfiguration.getProperty ServletFilterConfiguration.getProperty Variable 'value' still contains backslashes as escape chars. Backslashes are removed by PropertyConverter.split Property and XML configuration are OK, I think. > 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 > > 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]