jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ard Schrijvers <a.schrijv...@onehippo.com>
Subject Workspace clone jackrabbit 2.1 not in line with jsr-283
Date Mon, 26 Jul 2010 15:25:35 GMT

perhaps already noticed, but afaics, Jackrabbit 2.1 contains some
inconsistencies with the spec for Workspace#clone(...)

It happens when cloning an existing non-shareable node to the same parent:

suppose we have:

     ` a1
          ` b1

1) when 'b' is not referenceable, you get:
javax.jcr.RepositoryException: Cloning inside a workspace is only
allowed for shareable nodes.  (this is not according spec afaik)
2) when 'b' is referenceable, and you use

workspace.clone(workspace.getName(), b1.getPath(), a1.getPath() + "/b2", true);

you get:

javax.jcr.RepositoryException: default: illegal workspace (same as current)

However, b1 should be moved to b2 afaics
3) when 'b' is referenceable, and you use

workspace.clone(workspace.getName(), b1.getPath(), a1.getPath() + "/b2", false);

you get:

     ` a1
          ` b2

This is wrong according spec.

Afaics, *all* three outcomes are not according the spec/api. It even
looks like the  'boolean removeExisting' logic is implemented
reversed. Furthermore, the different behaviour for referenceable nodes
is not completely clear to me either. Below is a unit test showing
issue (3). When changing 'removeExisting = true', it is a test for (2)

Thx for any feedback,

Regards Ard


public void testIssueWspClone() throws Exception {
        // setup parent nodes and first child
        Node a1 = testRootNode.addNode("a1");
        Node a2 = testRootNode.addNode("a2");
        Node b1 = a1.addNode("b1");

        // add mixin

        // clone
        Workspace workspace = b1.getSession().getWorkspace();
        try {
b1.getPath(),a1.getPath() + "/b2", false);
          fail("We shouldn't get here as 'removeExisting = false' and
the node is not shareable");
        } catch(ItemExistsException e) {
          // We should get here...but we don't


View raw message