[
https://issues.apache.org/jira/browse/SLING-12944?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18021921#comment-18021921
]
Joerg Hoh commented on SLING-12944:
-----------------------------------
I assume that the problem here is a bit different ...
Excerpt from the stacktrace
{code}
at
org.apache.sling.servlets.post.impl.helper.JCRSupport.isPropertyMultiple(JCRSupport.java:116)
[org.apache.sling.servlets.post:2.6.0]
at
org.apache.sling.servlets.post.impl.helper.SlingPropertyValueHandler.isMultiValue(SlingPropertyValueHandler.java:368)
[org.apache.sling.servlets.post:2.6.0]
{code}
[SlingValuePropertyHandler, line
364ff|https://github.com/apache/sling-org-apache-sling-servlets-post/blob/fddcb337eb69ed33c9c5a7afc68713d193c96e9b/src/main/java/org/apache/sling/servlets/post/impl/helper/SlingPropertyValueHandler.java#L359-L368]
{code}
// nothing in the request, so check the current JCR property definition
final Object value = parent.valueMap.get(prop.getName());
if ( parent.node != null ) {
if ( value != null ) {
return jcrSupport.isPropertyMultiple(parent.node,
prop.getName());
}
} else {
if ( value != null && value.getClass().isArray() ) {
return true;
}
}
{code}
With the latest change we can resolve {{value}} and get a non-null value, and
for that reason the code now goes onto the JCR layer to find out if's a
multi-value property.
Previously it skipped it failed at the null-check and then skipped the entire
code and returned false.
In that case I assume that we have a clash in the assumptions of the
SlingPostServlet, as it assumes that every element in a ValueMap is backed by a
JCR property. Which could be the case, but it is not always true anymore.
> SlingPostServlet fails with JCR Resource 3.3.4
> ----------------------------------------------
>
> Key: SLING-12944
> URL: https://issues.apache.org/jira/browse/SLING-12944
> Project: Sling
> Issue Type: Bug
> Components: API
> Affects Versions: JCR Resource 3.3.4
> Reporter: Joerg Hoh
> Assignee: Konrad Windszus
> Priority: Major
>
> I am just testing the latest JCR Resource 3.3.4 with an recent development
> state of AEM, and the following POST fails with a status 422 (works fine with
> JCR Resource 3.3.2)
> {code}
> $ curl -svo /dev/null -u admin:admin -Fsling:resourceType=ab/cd
> localhost:4502/tmp/test1
> {code}
> (that path did not exist yet)
> {code}
> 22.09.2025 12:33:27.982 *WARN* [[0:0:0:0:0:0:0:1] [1758537207973] POST
> /tmp/test1 HTTP/1.1] org.apache.sling.servlets.post.impl.SlingPostServlet
> Exception while handling POST on path [/tmp/test1] with operation
> [org.apache.sling
> .servlets.post.impl.operations.ModifyOperation]
> org.apache.sling.servlets.post.exceptions.PreconditionViolatedPersistenceException:
> sling:resourceType not found on /tmp/test1
> at
> org.apache.sling.servlets.post.impl.helper.JCRSupportImpl.isPropertyMultiple(JCRSupportImpl.java:230)
> [org.apache.sling.servlets.post:2.6.0]
> at
> org.apache.sling.servlets.post.impl.helper.JCRSupport.isPropertyMultiple(JCRSupport.java:116)
> [org.apache.sling.servlets.post:2.6.0]
> at
> org.apache.sling.servlets.post.impl.helper.SlingPropertyValueHandler.isMultiValue(SlingPropertyValueHandler.java:368)
> [org.apache.sling.servlets.post:2.6.0]
> at
> org.apache.sling.servlets.post.impl.helper.SlingPropertyValueHandler.setPropertyAsIs(SlingPropertyValueHandler.java:236)
> [org.apache.sling.servlets.post:2.6.0]
> at
> org.apache.sling.servlets.post.impl.helper.SlingPropertyValueHandler.setProperty(SlingPropertyValueHandler.java:124)
> [org.apache.sling.servlets.post:2.6.0]
> at
> org.apache.sling.servlets.post.impl.operations.ModifyOperation.writeContent(ModifyOperation.java:372)
> [org.apache.sling.servlets.post:2.6.0]
> at
> org.apache.sling.servlets.post.impl.operations.ModifyOperation.doRun(ModifyOperation.java:93)
> [org.apache.sling.servlets.post:2.6.0]
> at
> org.apache.sling.servlets.post.impl.operations.AbstractPostOperation.run(AbstractPostOperation.java:103)
> [org.apache.sling.servlets.post:2.6.0]
> at
> org.apache.sling.servlets.post.impl.SlingPostServlet.doPost(SlingPostServlet.java:249)
> [org.apache.sling.servlets.post:2.6.0]
> [...]
> Caused by: javax.jcr.PathNotFoundException: sling:resourceType not found on
> /tmp/test1
> at
> org.apache.jackrabbit.oak.jcr.session.NodeImpl$11.perform(NodeImpl.java:660)
> [org.apache.jackrabbit.oak-jcr:1.84.0.T20250917093322-af8592b]
> at
> org.apache.jackrabbit.oak.jcr.session.NodeImpl$11.perform(NodeImpl.java:653)
> [org.apache.jackrabbit.oak-jcr:1.84.0.T20250917093322-af8592b]
> at
> org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.perform(SessionDelegate.java:236)
> [org.apache.jackrabbit.oak-jcr:1.84.0.T20250917093322-af8592b]
> at
> org.apache.jackrabbit.oak.jcr.session.ItemImpl.perform(ItemImpl.java:113)
> [org.apache.jackrabbit.oak-jcr:1.84.0.T20250917093322-af8592b]
> at
> org.apache.jackrabbit.oak.jcr.session.NodeImpl.getProperty(NodeImpl.java:653)
> [org.apache.jackrabbit.oak-jcr:1.84.0.T20250917093322-af8592b]
> at
> org.apache.sling.servlets.post.impl.helper.JCRSupportImpl.isPropertyMultiple(JCRSupportImpl.java:227)
> [org.apache.sling.servlets.post:2.6.0]
> ... 195 common frames omitted
> {code}
> the following call works:
> {code}
> $ curl -u admin:admin -Ffoo=bar localhost:4502/tmp/test1
> {code}
> /CC [~kwin]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)