You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Chetan Mehrotra (JIRA)" <ji...@apache.org> on 2012/10/27 21:23:12 UTC

[jira] [Comment Edited] (OAK-250) Enforce jcr constraints for 'protected' items

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

Chetan Mehrotra edited comment on OAK-250 at 10/27/12 7:22 PM:
---------------------------------------------------------------

[~anchela] - Should not the checkProtected() method logic be enforced via CommitHook? 

Because after this change the content import is failing because for a new node which is under construction checkProtected() triggers Node Definition evaluation and that fails if the primaryType is specified after a node is added. Below is one of the stacktraces observed

{noformat}
12417 [main] ERROR com.day.jcr.vault.packaging.impl.ZipVaultPackage - Error during install.
javax.jcr.RepositoryException: No matching node definition found for Node[NodeDelegate[/etc/clientlibs/granite/jquery]]
	at org.apache.jackrabbit.oak.jcr.NodeImpl.getDefinition(NodeImpl.java:999)
	at org.apache.jackrabbit.oak.jcr.ItemImpl.checkProtected(ItemImpl.java:259)
	at org.apache.jackrabbit.oak.jcr.NodeImpl.addNode(NodeImpl.java:216)
	at com.day.jcr.vault.fs.impl.io.FolderArtifactHandler.accept(FolderArtifactHandler.java:83)
{noformat}

For now I am trying to workaround it by modifying the checkProtected logic to ignore check for new nodes

{code:java}
 void checkProtected() throws RepositoryException {
+       if(isNew()){
+           return;
+       }
        ItemDefinition definition = (isNode()) ? ((Node) this).getDefinition() : ((Property) this).getDefinition();
        checkProtected(definition);
    }
{code}
                
      was (Author: chetanm):
    [~anchela] - Should not the checkProtected() method logic be enforced via CommitHook? 

Because after this change the content import is failing because for a new node which is under construction checkProtected() triggers Node Definition evaluation and that fails if the primaryType is specified after a node is added. Below is one of the stacktraces observed

{noformat}
12417 [main] ERROR com.day.jcr.vault.packaging.impl.ZipVaultPackage - Error during install.
javax.jcr.RepositoryException: No matching node definition found for Node[NodeDelegate[/etc/clientlibs/granite/jquery]]
	at org.apache.jackrabbit.oak.jcr.NodeImpl.getDefinition(NodeImpl.java:999)
	at org.apache.jackrabbit.oak.jcr.ItemImpl.checkProtected(ItemImpl.java:259)
	at org.apache.jackrabbit.oak.jcr.NodeImpl.addNode(NodeImpl.java:216)
	at com.day.jcr.vault.fs.impl.io.FolderArtifactHandler.accept(FolderArtifactHandler.java:83)
{noformat}
                  
> Enforce jcr constraints for 'protected' items
> ---------------------------------------------
>
>                 Key: OAK-250
>                 URL: https://issues.apache.org/jira/browse/OAK-250
>             Project: Jackrabbit Oak
>          Issue Type: Sub-task
>          Components: jcr
>            Reporter: angela
>


--
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