DO NOT REPLY [Bug 37667] - [configuration] BaseConfiguration.addProperty() and MapConfiguration.addProperty() do not behave the same
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=37667. 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=37667 --- Additional Comments From [EMAIL PROTECTED] 2005-12-02 15:40 --- I created the same test as you (copy/paste) and the assertion failed: size() returns 1. As I tried to explain it in the bug description, adding properties to existing values simply overwrites the preceeding ones. I had a look at the code: AbstractConfiguration defines addProperty() which calls the abstract addPropertyDirect(), which in turn is implemented in MapConfiguration as follows: protected void addPropertyDirect(String key, Object obj) { map.put(key, obj); } As Map.put() overwrites any existing values, the contract of addProperty is not respected. I downloaded the binaries and sources from the apache website, current the version is 1.1. So as it is working for you, I decided to look at the SVN version. The code for addPropertyDirect seems to be better up there: protected void addPropertyDirect(String key, Object value) { Object previousValue = getProperty(key); if (previousValue == null) { map.put(key, value); } else if (previousValue instanceof List) { // the value is added to the existing list ((List) previousValue).add(value); } else { // the previous value is replaced by a list containing the previous value and the new value List list = new ArrayList(); list.add(previousValue); list.add(value); map.put(key, list); } } So I think the bug I'm describing has been fixed, but is not currently available in the latest release... When is the next release planned for? -- 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 37667] - [configuration] BaseConfiguration.addProperty() and MapConfiguration.addProperty() do not behave the same
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=37667. 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=37667 [EMAIL PROTECTED] changed: What|Removed |Added Status|NEEDINFO|RESOLVED Resolution||WORKSFORME --- Additional Comments From [EMAIL PROTECTED] 2005-12-02 16:30 --- We are in the process of getting the next release out. You can find the latest release candidate here: http://people.apache.org/~oheger/commons-configuration-1.2RC2/ (Your issue should have been fixed in this version.) If there are no unexpected issues, commons-configuration 1.2 final should be available really soon now. There won't be much difference to the release candidate mentioned above. Okay, I am closing this ticket now. -- 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 37667] - [configuration] BaseConfiguration.addProperty() and MapConfiguration.addProperty() do not behave the same
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=37667. 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=37667 [EMAIL PROTECTED] changed: What|Removed |Added Status|NEW |NEEDINFO Summary|BaseConfiguration.addPropert|[configuration] |y() and |BaseConfiguration.addPropert |MapConfiguration.addProperty|y() and |() do not behave the same |MapConfiguration.addProperty ||() do not behave the same --- Additional Comments From [EMAIL PROTECTED] 2005-11-29 13:39 --- Looking at the source of MapConfiguration properties with multiple values seem to be treated correctly. To be sure I ran the following test case: public void testAddProperty() { Configuration config = new MapConfiguration(new HashMap()); config.addProperty(key, value1); config.addProperty(key, value2); assertEquals(Property has only a single value, 2, config.getList(key).size()); } This works for me. So, could you please double check? Or didn't I understand your problem correctly? -- 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]