Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.3
-
None
-
None
-
I think it does not matter because of pure java
Description
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()))
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