[ http://issues.apache.org/jira/browse/JCR-581?page=all ]
Stefan Guggisberg closed JCR-581.
---------------------------------
Resolution: Invalid
hi david,
the target location of the clone, a node of type nt:folder only allows child
nodes of type nt:hierarchyNode, i.e. nt:file or nt:folder which both extend
from nt:hierarchyNode. you're trying to create a child node of type
test:myResource (which doesn't extend from nt:hierarchyNode),
therefore the aforementioned exception is thrown.
your code could be easily fixed by creating a nt:file node with a jcr:content
subnode of type test:myResource.
btw: the reason why cloning to / succeeded is that root extends from
nt:unstructered which allows any child nodes of any type.
> Workspace.clone() fails when source path and dest path have different depth
> ---------------------------------------------------------------------------
>
> Key: JCR-581
> URL: http://issues.apache.org/jira/browse/JCR-581
> Project: Jackrabbit
> Issue Type: Bug
> Components: core
> Affects Versions: 1.1
> Reporter: David Garcia
> Assigned To: Stefan Guggisberg
> Attachments: repository.xml, TestClone.java
>
>
> Hi,
> Cloning nodes between workspaces throws the following exception:
> javax.jcr.nodetype.ConstraintViolationException: no matching child node
> definition found for {}A resource
> at
> org.apache.jackrabbit.core.nodetype.EffectiveNodeType.getApplicableChildNodeDef(EffectiveNodeType.java:737)
> at
> org.apache.jackrabbit.core.nodetype.EffectiveNodeType.checkAddNodeConstraints(EffectiveNodeType.java:654)
> at
> org.apache.jackrabbit.core.BatchedItemOperations.checkAddNode(BatchedItemOperations.java:583)
> at
> org.apache.jackrabbit.core.BatchedItemOperations.copy(BatchedItemOperations.java:291)
> at
> org.apache.jackrabbit.core.WorkspaceImpl.internalCopy(WorkspaceImpl.java:296)
> at
> org.apache.jackrabbit.core.WorkspaceImpl.clone(WorkspaceImpl.java:403)
> at TestWS.main(TestWS.java:54)
> when srcAbsPath and destAbsPath have different depths. Other cases might fail
> too; changing just the node´s name works, though.
> In the attached test, the node "/A resource" is cloned to two different paths:
> - "/Same resource" works ok.
> - "/folder/A resource" throws the exception shown above.
> Maybe I´m doing something wrong here, so please have a look at the attached
> source code.
> The test also registers a new namespace and a node type definition so that it
> works exactly the same way as the "real" code in our application.
> Thanks in advance.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira