[CDO] How does CDOResourceNode.setFolder(...) work? [message #1795177] |
Mon, 17 September 2018 21:57 |
Reinhold Usolf Messages: 18 Registered: December 2016 |
Junior Member |
|
|
Hi,
I want to move an existing CDOResourceNode to a different folder. When I call
node.setFolder("the/destination/folder")
on a node with name "mynode", I get this exception:
org.eclipse.emf.cdo.common.util.CDOException: Duplicate path: "the/destination/folder/mynode"
org.eclipse.emf.cdo.eresource.impl.CDOResourceNodeImpl.checkDuplicates(CDOResourceNodeImpl.java:307)
org.eclipse.emf.cdo.eresource.impl.CDOResourceNodeImpl.basicSetFolder(CDOResourceNodeImpl.java:123)
org.eclipse.emf.cdo.eresource.impl.CDOResourceNodeImpl.setFolder(CDOResourceNodeImpl.java:106)
org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl.setFolder(CDOResourceImpl.java:472)
The exception happens always, independently of what the new path is and whether the path is really a duplicate or not.
As a work-around, I try to disable the check for duplicates like this:
((CDOResourceNodeImpl)node).basicSetFolder("the/destination/folder",false)
Not nice, but this works actually!
But: I cannot move a node to the root with this:
node.setFolder(null) (or with basicSetFolder)
When I do this, the node just disappears forever. It does not appear in the contents of the root node. When I have a write lock on the node, unlock() gives a NullPointerException. This is strange because you can see in the source code of basicSetFolder that it can handle the case where the destination folder is null (i.e. root).
Obviously, setFolder works very differently from what I expected intuitively. How do you use the method correctly?
Edit: Better formulation: What is the correct way to move an existing resource to a different folder or to the root?
I am using version 4.5. I have checked the release notes of 4.6 and 4.7 but I don't see any related bugfixes.
[Updated on: Tue, 18 September 2018 09:00] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03849 seconds