You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chemistry.apache.org by "Florian Müller (JIRA)" <ji...@apache.org> on 2017/07/21 12:04:02 UTC
[jira] [Commented] (CMIS-1041) Commons Properties API inconsistence
between List and Map
[ https://issues.apache.org/jira/browse/CMIS-1041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16096169#comment-16096169 ]
Florian Müller commented on CMIS-1041:
--------------------------------------
Thanks for the hint!
The {{addProperty}} method now throws an exception if an already existing property should be added.
The {{replaceProperty}} method should be used to change a property.
> Commons Properties API inconsistence between List and Map
> ---------------------------------------------------------
>
> Key: CMIS-1041
> URL: https://issues.apache.org/jira/browse/CMIS-1041
> Project: Chemistry
> Issue Type: Bug
> Components: opencmis-commons
> Affects Versions: OpenCMIS 1.1.0
> Reporter: Sascha Homeier
> Assignee: Florian Müller
> Priority: Minor
>
> _org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl,_ the provided implementation of the _MutableProperties_ Interface in Commons API is backed by a List and Map to provide these two different views via _getPropertyList_ and_ getProperties_.
> If a Property with the same ID is added twice via _addProperty_ the Map replaces the old property while the List appends the new one.
> Junit Test:
> {code}@Test
> public void testProperties_OpenCMISImpl() throws Exception
> {
> MutableProperties properties = new PropertiesImpl();
> PropertyData<String> propertyOne = new PropertyStringImpl("my:test", "testOne");
> PropertyData<String> propertyTwo = new PropertyStringImpl("my:test", "testTwo");
> properties.addProperty(propertyOne);
> Assert.assertEquals(1, properties.getProperties().size());
> Assert.assertEquals(1, properties.getPropertyList().size());
> properties.addProperty(propertyTwo);
> // map replaces old property by new one, so only one entry here
> Assert.assertEquals(1, properties.getProperties().size());
> // list appends at the end, so two entries here
> Assert.assertEquals(2, properties.getPropertyList().size());
> }{code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)