[
https://issues.apache.org/jira/browse/OAK-5229?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15865483#comment-15865483
]
angela commented on OAK-5229:
-----------------------------
I agree with [~alexparvulescu] and [~mreutegg] regarding being as conservative
as possible. We clearly have to take care about the protected items that cannot
be altered/removed through JCR API calls but only if the new _effective node
type_ doesn't provide a matching item definition. I don't recall the very
details of the patch and whether or not it uses the effective node type to spot
those 'illegal' items... but that's how it should be from my pov.
If changing the primary type or modification of mixin types changes the item
definition of a given node or property in a valid way this shouldn't lead to a
removal or throwing an exception IMO. So far we never treated the protected
items defined by JCR specification as really reserved... and if we would go
this way we actually would need to prevent the usage of these items outside of
the context they are defined but that would for sure require a much bigger
refactoring and is likely to introduce some compatibility issues.... I did this
for protected items I introduced more recently with Oak specific, system
maintained items... but I am not sure if doing this for something like
{{jcr:uuid}} or {{jcr:baseVersion}} or {{jcr:owner}} or {{jcr:title}} or
{{jcr:data}} was really sensible.
> 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
>
>
> 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)