Re: Item.getPath() returns wrong values on shared nodes

2008-09-25 Thread Julian Reschke

Manfred Baedke wrote:

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. 

 ...

Just re-stating that the problem (wrong path being computed) causes a 
rather catastrophic failure (wrong node being deleted).


Should I add the test case to ShareableNodeTests? And if I do, should I 
mark it somewhere as known failure?


BR, Julian


Item.getPath() returns wrong values on shared nodes

2008-09-23 Thread Manfred Baedke

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