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

Claudio Corrodi claudio.corrodi at wyona.com
Mon Aug 30 16:15:52 CEST 2010


On 08/27/2010 09:06 AM, Cedric Staub wrote:
> On Fri, Aug 27, 2010 at 08:57:37AM +0200, Claudio Corrodi wrote:
>> 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?
>
> I guess that depends on whether the path is used somewhere else in a
> diffrent manner. Personally, I would just do something like this:
>
> String path = getPath();
> if(path.endsWith("/")) return path + name
> else return path + "/" + name
>
> That way there's no need to care about whether or not to strip the
> trailing slash either.

Yes, but where would you do that exactly? In 
VirtualFileSystemRepository.getNode (that's what I would do)? Or in 
AbstractNode (and VirtualFileSystemNode, because there also occurs a 
line "String newPath = getPath() + "/" + name;" where we could end up 
with "//hello_world.txt")? Either way, I guess we need to do something 
here...

Cheers, Claudio


More information about the Yanel-development mailing list