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 "Jukka Zitting (JIRA)" <ji...@apache.org> on 2013/11/01 16:29:17 UTC

[jira] [Created] (OAK-1139) Avoid the duplicate property lookup during getProperty("name").getString()

Jukka Zitting created OAK-1139:
----------------------------------

             Summary: Avoid the duplicate property lookup during getProperty("name").getString()
                 Key: OAK-1139
                 URL: https://issues.apache.org/jira/browse/OAK-1139
             Project: Jackrabbit Oak
          Issue Type: Improvement
          Components: jcr
            Reporter: Jukka Zitting
            Assignee: Jukka Zitting


Currently the following JCR code snippet causes a duplicate NodeState-level property lookup:

{code}
node.getProperty("name").getString();
{code}

The reason for this is that the {{getProperty()}} call needs to first check for whether the property exists (otherwise it should throw an exception), which results in a {{SecureNodeBuilder.hasProperty()}} call, which in turn needs to call {{getProperty()}} as the permission checks use the full {{PropertyState}} instead of just the property name. But then the retrieved property state is discarded.

Then during the {{getString()}} call the previously returned {{PropertyDelegate}} will re-retrieve the underlying {{PropertyState}}.

A better alternative would be to either make the permission checks use just the property name or to make the {{PropertyDelegate}} keep track of the already retrieved {{PropertyState}}.



--
This message was sent by Atlassian JIRA
(v6.1#6144)