// root - the base filename
// name - The name to resolve.
// scope - The NameScope to use when resolving the name.
// update the child FileObjects GeneralFile.
FileName fn = getFileSystem().getFileSystemManager().
resolveName(getName(), UriParser.encode(childname), NameScope.CHILD);
//log.debug("childname: [" + childname + "] fnStr: [" + fn.toString() + "] fnBas: [" + fn.getBaseName() + "]");
/**
* VFS resolveName and Jargon GeneralFile.getName() bug.
* Refer to results of following debug statement in explanation:
* log.debug("childname: [" + childname + "] fnStr: [" + fn.toString() + "] fnBas: [" + fn.getBaseName() + "]");
*
* A) Output of SRB Sls:
* =====================
* [ngs0153@ngs ~]$ Sls /ngs/home
* C-/ngs/home/http://marc.theaimsgroup.com/?l=redhat-list&m=109219329520329&w=2.ngs
* C-/home/ngs/david-meredith.ngs
* ...
* Note, that the file listing above contains a collection whose name
* begins with a url "http;//marc.theaimsgroup.com.."
*
*
* B) Name retireved by Jargon (child.getName()):
* ==============================================
* childname: [?l=redhat-list&m=109219329520329&w=2.ngs]
*
* Note, that the child name does not include the url
* part of the file name ("http;//marc.theaimsgroup.com..").
*
*
* D) FileName resolved by VFS (fn above)
* ========================================
* fnStr: [srb://srb1.ngs.rl.ac.uk/ngs/home?l=redhat-list&m=109219329520329&w=2.ngs]
* fnBas: [home]
*
* Note that the fn.toString() does not include the url part of the file name and also drops the
* file separator betweeen the home dir and the file name ("/ngs/home?l=redhat...").
* As a result, the fn.getBaseName() returns 'home' which is wrong.
*/
// Due to above bug, need to check that childname == fn.getBaseName()
// otherwise, will not be able to resolveFile correctly which causes ex.
if (fn != null && childname != null && childname.equals(fn.getBaseName())) {
//&& !"srb://srb1.ngs.rl.ac.uk/ngs/home?l=redhat-list&m=109219329520329&w=2.ngs".equals(fn.toString())) {
SrbGeneralFileFileObject fo = (SrbGeneralFileFileObject) getFileSystem().resolveFile(fn);
// Could also pass string to resolveFile and this must be an absPath !
//SrbGeneralFileFileObject fo = (SrbGeneralFileFileObject) getFileSystem().resolveFile(getName().getPath() + getName().SEPARATOR + childname);