[Yanel-dev] org.wyona.yarep.impl.repo.vfs.VirtualFileSystemRepository#getNode(java.lang.String) question

Claudio Corrodi claudio.corrodi at wyona.com
Fri Aug 27 08:57:37 CEST 2010


Hi list,

I have a question regarding the getNode method of the 
org.wyona.yarep.impl.repo.vfs.VirtualFileSystemRepository class.

In the function getNode, a trailing slash is removed only if the path of 
the current node is longer than 1 character (which means only if the 
node is not the root node). In an application, I'm getting the root node 
and calling "hasNode" on it with the following code:

Node root = myrepo.getRootNode();
root.hasNode("hello_world.txt");

Now the hasNode method of org.wyona.yarep.impl.AbstractNode generates 
the absolute path of the child with the following line

String childPath = getPath() + "/" + name;

But since I'm calling this in the root node, getPath() yields "/" and I 
end up with childPath = "//hello_world.txt" which causes existsNode to 
return false, although the node exists.

So my question here is: Does it make sense to only remove the trailing 
slash in VirtualFileSystemRepository#getNode if it's not the root node?

Regards, Claudio


More information about the Yanel-development mailing list