[
https://issues.apache.org/jira/browse/CONFIGURATION-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12491590
]
Emmanuel Bourg commented on CONFIGURATION-224:
----------------------------------------------
There is another alternative to this issue : getProperty() could return a
decorator for Collection properties, the decorator would intercept the
modifications to the collection and generate a configuration event.
That may be interesting for the getList() methods, I think it's important that
getProperty() returns the stored object without modification.
> BaseConfiguration.getProperty() returns reference to intenal store collection
> object instead of a clone
> -------------------------------------------------------------------------------------------------------
>
> Key: CONFIGURATION-224
> URL: https://issues.apache.org/jira/browse/CONFIGURATION-224
> Project: Commons Configuration
> Issue Type: Bug
> Environment: 1.3RC2
> Reporter: Gabriele Garuglieri
> Priority: Minor
> Fix For: 1.3
>
> 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.
-
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]