[
https://issues.apache.org/jira/browse/SLING-4116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14189706#comment-14189706
]
Carsten Ziegeler commented on SLING-4116:
-----------------------------------------
Thanks [~rombert] for the patch, I've applied it and also cleaned up the code a
little bit and removed unnecessary fields.
[~dsuess] Could you please give this a try?
> Content length check in JCRNodeResourceMetadata triggers
> javax.jcr.ItemNotFoundException: No primary item present on node
> -------------------------------------------------------------------------------------------------------------------------
>
> Key: SLING-4116
> URL: https://issues.apache.org/jira/browse/SLING-4116
> Project: Sling
> Issue Type: Bug
> Components: JCR
> Affects Versions: JCR Resource 2.3.12
> Reporter: Robert Munteanu
> Assignee: Carsten Ziegeler
> Fix For: JCR Resource 2.3.14
>
>
> As reported by [~dsuess] on [dev@sling - ResourceWrapper issue with
> ResourceMetadata|http://sling-dev.markmail.org/thread/aauecevkxjnbk4vi] , the
> code trying to guess the content-length can cause ItemNotFoundExceptions to
> be logged by calling {{Item.getPrimaryItem()}}.
> By looking at the Jackrabbit and Oak implementations, the getPrimaryItem()
> method does the following
> {code:java}
> String name = getPrimaryNodeType().getPrimaryItemName();
> if (name == null) {
> throw new ItemNotFoundException();
> }
> if (hasProperty(name)) {
> return getProperty(name);
> } else if (hasNode(name)) {
> return getNode(name);
> } else {
> throw new ItemNotFoundException();
> }
> {code}
> We should replicate this check to make sure that we no longer cause these
> exceptions to be thrown and logged.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)