[ 
https://issues.apache.org/jira/browse/OAK-5229?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15855767#comment-15855767
 ] 

Alex Parvulescu commented on OAK-5229:
--------------------------------------

Thanks Angela for taking a look at this!

bq. The right fix for the latter would be to adjust the test-case (-> 
TypeEditor doesn't complain) and thus have the CugValidator trigger.
Got it. I updated the test to match the expected node structure and now it 
passes.

bq. Therefore, I would suggest that we perform an additional best-effort check 
in oak-jcr and fail as early as possible.
Agreed will go through existing code to figure out how the mixin part works now.
Without meaning to sidetrack the discussion, looking at the eager mixin 
validation something looks a bit off to me [0]. Is it really the case that we 
don't need to check permissions in the case of an {{addMixin}} call as it 
happens for example on {{removeMixin}} and {{canAddMixin}}?


[0] 
https://github.com/apache/jackrabbit-oak/blob/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/NodeImpl.java#L954

> Using Node.setPrimaryType() should fail if non-matching childnodes
> ------------------------------------------------------------------
>
>                 Key: OAK-5229
>                 URL: https://issues.apache.org/jira/browse/OAK-5229
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.5.14
>            Reporter: Tobias Bocanegra
>            Assignee: Alex Parvulescu
>            Priority: Critical
>             Fix For: 1.8, 1.6.1
>
>         Attachments: OAK-5229.patch, OAK-5229-tests.patch, OAK-5229-v2.patch
>
>
> 1. Assume the following:
> {noformat}
> /testNode [nt:unstructured]
>   /unstructured_child [nt:unstructured]
> {noformat}
> 2. setting "/testNode".setPrimaryType("nt:folder")
> 3. save the session.
> Altering the primary type works, thus leaving the repository in an 
> inconsistent state.
> Interestingly, subsequent calls to 
> "/testNiode/unstructured_child".setProperty() will fail:
> {noformat}
> javax.jcr.nodetype.ConstraintViolationException: OakConstraint0001: 
> /test_node[[nt:folder]]: No matching definition found for child node 
> unstructured_child with effective type [nt:unstructured]
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to