jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manfred Baedke <manfred.bae...@greenbytes.de>
Subject Item.getPath() returns wrong values on shared nodes
Date Tue, 23 Sep 2008 20:27:57 GMT
Hi,

currently I am working on the integration of WebDAV binding extensions 
into |org.apache.jackrabbit.webdav.simple.SimpleWebdavServlet|, using 
the shareable node feature of jsr-283.
The implementation of the BIND method was straightforward and worked as 
expected, but I noticed that sometimes DELETE removed the wrong binding. 
It turned out that  |org.apache.jackrabbit.core.NodeImpl.removeShare()| 
did not remove the node itself, but instead another node from the same 
shared set. Apparently the methods |ItemImpl.getPath()| and 
|ItemImpl.getPrimaryPath()| have unexpected results in these cases.
The following testcase illustrates the issue if included into the test 
class |org.apache.jackrabbit.core.ShareableNodeTest|:

/**
 * Verify that shared nodes return correct paths.
 */
public void testPath() throws Exception {
    Node a1 = testRootNode.addNode("a1");
    Node a2 = a1.addNode("a2");
    Node b1 = a1.addNode("b1");
    b1.addMixin("mix:shareable");
    testRootNode.save();

    //now we have a shareable node N with path a1/b1

    Session session = testRootNode.getSession();
    Workspace workspace = session.getWorkspace();
    String path = a2.getPath() + "/b2";
    workspace.clone(workspace.getName(), b1.getPath(), path, false);

    //now we have another shareable node N' in the same shared set as N 
with path a1/a2/b2

    //using the path a1/a2/b2, we should get the node N' here
    Item item = session.getItem(path);
    String p = item.getPath();
    assertFalse("unexpectedly got the path from another node from the 
same shared set ", p.equals(b1.getPath()));
}

Regards,
Manfred

-- 
Manfred Baedke

<green/>bytes GmbH
Hafenweg 16
D-48155 Münster
Germany
Amtsgericht Münster: HRB5782 

-- 
Manfred Baedke

<green/>bytes GmbH
Hafenweg 16
D-48155 Münster
Germany
Amtsgericht Münster: HRB5782 


Mime
View raw message