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 "Joerg Hoh (Jira)" <ji...@apache.org> on 2024/10/15 08:36:00 UTC
[jira] [Assigned] (OAK-11187) Implement NodeImpl.getParentOrNull
[ https://issues.apache.org/jira/browse/OAK-11187?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Joerg Hoh reassigned OAK-11187:
-------------------------------
Assignee: Joerg Hoh
> Implement NodeImpl.getParentOrNull
> ----------------------------------
>
> Key: OAK-11187
> URL: https://issues.apache.org/jira/browse/OAK-11187
> Project: Jackrabbit Oak
> Issue Type: Bug
> Components: core, jackrabbit-api
> Reporter: Joerg Hoh
> Assignee: Joerg Hoh
> Priority: Major
>
> The JackrabbitSession already has an default implementation of
> {noformat}
> default Node getParentOrNull(@NotNull Item item) throws RepositoryException
> {noformat}
> but internally there is no optimized version available. This can be useful, as I have seen cases in threaddumps, where the Node.getParent() implementation creates an AccessDeniedException; so there is definitely some value in an implementation of {{getParentOrNull}} in the JR extensions which avoids the creation of such an exception.
> I have here a series of threaddumps, and of the 35 instances of {{JackrabbitSesion.getParentOrNull()}} 22 look like this:
> {noformat}
> at java.lang.Throwable.fillInStackTrace(java.base@11.0.23/Native Method)
> at java.lang.Throwable.fillInStackTrace(java.base@11.0.23/Throwable.java:787)
> - locked <0x00000007300d7860> (a javax.jcr.AccessDeniedException)
> at java.lang.Throwable.<init>(java.base@11.0.23/Throwable.java:255)
> at java.lang.Exception.<init>(java.base@11.0.23/Exception.java:54)
> at javax.jcr.RepositoryException.<init>(RepositoryException.java:17)
> at javax.jcr.security.AccessControlException.<init>(AccessControlException.java:21)
> at javax.jcr.AccessDeniedException.<init>(AccessDeniedException.java:17)
> at org.apache.jackrabbit.oak.jcr.session.NodeImpl$1.perform(NodeImpl.java:195)
> at org.apache.jackrabbit.oak.jcr.session.NodeImpl$1.perform(NodeImpl.java:186)
> at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.perform(SessionDelegate.java:229)
> at org.apache.jackrabbit.oak.jcr.session.ItemImpl.perform(ItemImpl.java:113)
> at org.apache.jackrabbit.oak.jcr.session.NodeImpl.getParent(NodeImpl.java:186)
> at org.apache.jackrabbit.api.JackrabbitSession.getParentOrNull(JackrabbitSession.java:272)
> at org.apache.sling.jcr.resource.internal.helper.jcr.JcrItemResourceFactory.getParentOrNull(JcrItemResourceFactory.java:218)
> {noformat}
> For that reason I think that in the cases where {{getParent()}} either hits the root node or a non-accessible parent node, the performance penalty of the exception is quite high.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)