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

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

attaching version v5 of the patch [^OAK-5229-v5.patch].

continued on the proposed path but I had to touch a few tests. I have to say 
that there was a heavy bias in the test toward removing extra properties even 
if they were allowed, which is an implementation detail (specs are fuzzy on 
this).
The most surprising ones are 
* {{MixinTest}} removes the mix:versionable mixin from an nt:unstructured node 
and expects the relevant versioning props to be removed with the change (it 
actually triggers an error from the reference editor). this is no loger the 
case, I adjusted the test to manually remove all extra properties
* {{AccessControlManagementTest}} removes rep:AccessControllable mixin and 
expects rep:policy node to be auto-removed. no longer the case. this is a 
loaded assuption, but I'm not sure if the change will cause trouble later.
* biased property checks in {{DeepLockTest}}, {{SessionScopedLockTest}} and 
{{OpenScopedLockTest}}. following Marcel's suggestion I changed the node type 
so the test will pass

Thanks to everyone providing feedback and please take another look, it seems 
we're reaching consensus and a proper patch I can apply soon!

ps. I'd like to split the patch in 2: the {{TypeEditor}} in one part and 
everything else in the second part. this would allow for backporting of the 
first part to prevent corruption while leaving some more time for the part 2 
changes to be tested a bit more.


> 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, 
> OAK-5229-v3.patch, OAK-5229-v4.patch, OAK-5229-v5.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