Robert Munteanu created SLING-4116:
--------------------------------------
Summary: 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
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)