[
https://issues.apache.org/jira/browse/SLING-2763?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13590444#comment-13590444
]
Alex Parvulescu commented on SLING-2763:
----------------------------------------
For the interested parties here's how the test behaves in Jackrabbit vs Oak
----
*Jackrabbbit*
JR sees a pure {{ConstraintViolationException}}:
bq. javax.jcr.nodetype.ConstraintViolationException: No child node definition
for child found in node /CreateFileTest/1362039965324.txt
The code fails at {{AbstractPostOperation#run}} [0] at the {{#doRun}} call
which throws a {{RepositoryException}}.
The original {{ConstraintViolationException}} bubbles up unwrapped and ends up
in the page.
Stacktrace
>> javax.jcr.nodetype.ConstraintViolationException: No child node definition
>> for child found in node /CreateFileTest/1362074352827.txt
at org.apache.jackrabbit.core.NodeImpl.addNode(NodeImpl.java:1276)
at
org.apache.jackrabbit.core.session.AddNodeOperation.perform(AddNodeOperation.java:111)
at
org.apache.jackrabbit.core.session.AddNodeOperation.perform(AddNodeOperation.java:37)
at
org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:216)
at org.apache.jackrabbit.core.ItemImpl.perform(ItemImpl.java:91)
at org.apache.jackrabbit.core.NodeImpl.addNodeWithUuid(NodeImpl.java:1814)
at org.apache.jackrabbit.core.NodeImpl.addNode(NodeImpl.java:1774)
at
org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.create(JcrResourceProvider.java:402)
at
org.apache.sling.resourceresolver.impl.ResourceResolverImpl.create(ResourceResolverImpl.java:1063)
at
org.apache.sling.servlets.post.impl.operations.AbstractCreateOperation.deepGetOrCreateNode(AbstractCreateOperation.java:537)
at
org.apache.sling.servlets.post.impl.operations.AbstractCreateOperation.processCreate(AbstractCreateOperation.java:109)
at
org.apache.sling.servlets.post.impl.operations.ModifyOperation.doRun(ModifyOperation.java:91)
at
org.apache.sling.servlets.post.AbstractPostOperation.run(AbstractPostOperation.java:92)
----
*Oak*
Oak sees a {{PersistenceException}}:
bq. org.apache.sling.api.resource.PersistenceException: Unable to commit
changes to session.
The code fails at later phase in the {{AbstractPostOperation#run}} [1] at the
{{ResourceResolver().commit()}} call which effectively wraps the
{{ConstraintViolationException}} into a {{PersistenceException}} as per its
contract, which makes in into the page.
Stacktrace
>> org.apache.sling.api.resource.PersistenceException: Unable to commit changes
>> to session.
at
org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.commit(JcrResourceProvider.java:461)
at
org.apache.sling.resourceresolver.impl.helper.ResourceResolverContext.commit(ResourceResolverContext.java:140)
at
org.apache.sling.resourceresolver.impl.ResourceResolverImpl.commit(ResourceResolverImpl.java:1077)
at
org.apache.sling.servlets.post.AbstractPostOperation.run(AbstractPostOperation.java:129)
----
[0]
http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/AbstractPostOperation.java?view=markup#l92
[0]
http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/AbstractPostOperation.java?view=markup#l129
> Tweak PostServletCreateTest.testCreatingNodeUnderFile test to allow the
> presence of a PersistenceException
> ----------------------------------------------------------------------------------------------------------
>
> Key: SLING-2763
> URL: https://issues.apache.org/jira/browse/SLING-2763
> Project: Sling
> Issue Type: Improvement
> Components: Testing
> Reporter: Alex Parvulescu
> Priority: Minor
>
> Running {{PostServletCreateTest.testCreatingNodeUnderFile}} against an Oak
> repo, the test fails because it expects to see a
> {{ConstraintViolationException}} on the page.
> As oak has a different behavior wrt the moment when it throws the
> {{ConstraintViolationException}}, it may end up being wrapped into a
> {{PersistenceException}} which will fail the test even if the overall
> expectations are met.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira