[ http://issues.apache.org/jira/browse/CONFIGURATION-224?page=comments#action_12435821 ] Gabriele Garuglieri commented on CONFIGURATION-224: ---------------------------------------------------
Hi Oliver, sorry, i've been out of office. I already solved my problem, as you said, making myself a clone of the returning list. About the problem, you may be right, indeed i missed that there are already other methods that returns a copy, so perhaps accurately documenting the behaviour of getProperty() may be enough. > BaseConfiguration.getProperty() returns reference to intenal store collection > object instead of a clone > ------------------------------------------------------------------------------------------------------- > > Key: CONFIGURATION-224 > URL: http://issues.apache.org/jira/browse/CONFIGURATION-224 > Project: Commons Configuration > Issue Type: Bug > Environment: 1.3RC2 > Reporter: Gabriele Garuglieri > Priority: Minor > Attachments: list.patch > > > When the property object is a List or an Array, > BaseConfiguration.getProperty() returns a reference to the object contained > in the store. > This means that changing that object, changes the content of the properties > store without an explicit setProperty() or addProperty(). > Also any change to the object in the store will change the object that the > code has reference to, but the user is not aware that the property has > changed unless he has added a ConfigurationListener. > Attached a patch to make the object returned by > BaseConfiguration.getProperty() a clone of store content, to avoid side > effects when changing Collection properties. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]