You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Michael Dürig (JIRA)" <ji...@apache.org> on 2012/12/13 11:36:14 UTC

[jira] [Commented] (OAK-510) Multivalued properties with array size 0 forget their type

    [ https://issues.apache.org/jira/browse/OAK-510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13530880#comment-13530880 ] 

Michael Dürig commented on OAK-510:
-----------------------------------

The last time this came up (can't find the reference neither) defaulting to string in this case was considered good enough. 
                
> Multivalued properties with array size 0 forget their type
> ----------------------------------------------------------
>
>                 Key: OAK-510
>                 URL: https://issues.apache.org/jira/browse/OAK-510
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core, jcr
>            Reporter: angela
>
> thought i remember that i have seen a related TODO or issue before, i
> couldn't find it any more... sorry for that.
> while cleaning up the node type code i found that one FIXME in the 
> ReadOnlyNodeTypeManager related to definition generation was only needed
> because the TypeValidator failed upon validation of an empty jcr:supertypes
> definition. not storing the super types if none has be declared solved the
> problem for the time being.
> however, it seems to me that the underlying problem is in a completely
> different area: namely that mv properties with an empty value array
> forget their type.
> this can be verified with the following test:
> {code}
>     @Test
>     public void addEmptyMultiValueName() throws RepositoryException {
>         Node parentNode = getNode(TEST_PATH);
>         Value[] values = new Value[0];
>         parentNode.setProperty("multi name", values);
>         parentNode.getSession().save();
>         Session session2 = createAnonymousSession();
>         try {
>             Property property = session2.getProperty(TEST_PATH + "/multi name");
>             assertTrue(property.isMultiple());
>             assertEquals(PropertyType.NAME, property.getType());
>             Value[] values2 = property.getValues();
>             assertEquals(values.length, values2.length);
>             assertEquals(values[0], values2[0]);
>             assertEquals(values[1], values2[1]);
>         } finally {
>             session2.logout();
>         }
>     }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira